/* =====================================================
   APP SHELL - Dark RTL Persian layout for Nexus (Phase 1)
   Fixed sidebar + top header, matching the React reference UI
===================================================== */

/* ---------- 1. Design tokens (dark theme override) ---------- */
:root {
    --app-bg: #0b0f19;
    --app-sidebar-bg: #0b0f19;
    --app-panel-bg: #131722;
    --app-panel-bg-alt: #161b26;
    --app-border: #1e293b;
    --app-border-lifted: #334155;
    --app-text: #e1e3e8;
    --app-text-muted: #94a3b8;
    --app-accent: #2563eb;
    --app-accent-hover: #3b82f6;
    --app-accent-soft: rgba(37, 99, 235, 0.15);
    --app-radius-sm: 0.5rem;
    --app-radius-md: 0.75rem;
    --app-radius-lg: 1rem;
    --app-sidebar-width: 264px;
    --app-sidebar-width-collapsed: 84px;
    --app-header-height: 64px;
}

/* Override Nexus design tokens to the dark palette so native components
   (cards, tables, buttons, alerts, form controls) inherit it automatically */
body.app-shell-body {
    --bg: var(--app-panel-bg);
    --bg-muted: var(--app-panel-bg-alt);
    --bg-lifted: #1a2030;
    --bg-accented: #212838;
    --bg-inverted: #f4f5f7;

    --text: var(--app-text);
    --text-muted: var(--app-text-muted);
    --text-lifted: #cbd5e1;
    --text-accented: #f1f5f9;
    --text-inverted: #0b0f19;

    --border: var(--app-border);
    --border-muted: #17202f;
    --border-lifted: var(--app-border-lifted);
    --border-accented: #475569;

    --primary: var(--app-accent);
    --primary-lifted: var(--app-accent-hover);
    --primary-accented: #1d4ed8;

    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--app-bg);
    color: var(--app-text);
    overflow-x: hidden;
}

body.app-shell-body,
body.app-shell-body *:not(i[class*="fa-"]) {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

body.app-shell-body code,
body.app-shell-body pre,
body.app-shell-body .font-mono {
    font-family: 'JetBrains Mono', 'Vazirmatn', monospace !important;
}

/* ---------- 2. RTL base ---------- */
body.app-shell-body {
    direction: rtl;
    text-align: right;
    /* theme.min.css خود WHMCS یه «border-top: 2px solid #dee2e6» روی
       body می‌ذاره که توی قالب تیره مثل یه خط روشن بالای صفحه دیده
       می‌شه. اینجا خنثی می‌شه. */
    border-top: 0;
}

/* ---------- 3. App shell layout ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: var(--app-bg);
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    margin-right: var(--app-sidebar-width);
    transition: margin-right 0.25s ease;
    background-color: var(--app-bg);
}

.app-shell.is-collapsed .app-main {
    margin-right: var(--app-sidebar-width-collapsed);
}

/* ---------- 4. Sidebar ---------- */
.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: var(--app-sidebar-width);
    background-color: var(--app-sidebar-bg);
    border-left: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: width 0.25s ease, transform 0.25s ease;
    overflow: hidden;
}

.app-shell.is-collapsed .app-sidebar {
    width: var(--app-sidebar-width-collapsed);
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--app-border);
    flex-shrink: 0;
}

.app-sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    min-width: 0;
}

.app-sidebar-brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--app-radius-md);
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    overflow: hidden;
}

.app-sidebar-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.app-sidebar-brand-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
}

.app-sidebar-brand-sub {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--app-accent-hover);
    letter-spacing: 0.05em;
}

.app-sidebar-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--app-radius-sm);
    background-color: var(--app-panel-bg-alt);
    border: 1px solid var(--app-border-lifted);
    color: var(--app-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.app-sidebar-toggle:hover {
    background-color: var(--app-border-lifted);
    color: #fff;
}

.app-shell.is-collapsed .app-sidebar-toggle i {
    transform: rotate(180deg);
}

.app-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.app-nav-item,
.app-nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: var(--app-radius-md);
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.app-nav-item:hover,
.app-nav-group-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
}

.app-nav-item.active {
    background-color: var(--app-accent);
    color: #fff;
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.app-nav-item-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.app-nav-icon {
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.85;
}

.app-nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shell.is-collapsed .app-nav-label,
.app-shell.is-collapsed .app-sidebar-brand-text,
.app-shell.is-collapsed .app-nav-caret,
.app-shell.is-collapsed .app-nav-badge,
.app-shell.is-collapsed .app-sidebar-user-info,
.app-shell.is-collapsed .app-sidebar-secondary-links span,
.app-shell.is-collapsed .app-sidebar-auth-buttons span {
    display: none;
}

.app-shell.is-collapsed .app-nav-item,
.app-shell.is-collapsed .app-nav-group-toggle {
    justify-content: center;
    padding: 0.75rem;
}

.app-nav-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background-color: var(--app-border-lifted);
    color: #e2e8f0;
    flex-shrink: 0;
}

.app-nav-item.active .app-nav-badge {
    background-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.app-nav-caret {
    font-size: 0.65rem;
    color: var(--app-text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.app-nav-group.is-open .app-nav-caret {
    transform: rotate(180deg);
}

.app-nav-collapse {
    display: none;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.3rem 0 0.3rem 0.5rem;
    margin-top: 0.2rem;
    border-right: 2px solid var(--app-border);
    margin-right: 1.1rem;
}

.app-nav-group.is-open .app-nav-collapse {
    display: flex;
}

.app-nav-subitem {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.app-nav-subitem:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
}

.app-nav-subitem.active {
    color: var(--app-accent-hover);
    font-weight: 800;
}

.app-sidebar-footer {
    border-top: 1px solid var(--app-border);
    padding: 0.75rem;
    flex-shrink: 0;
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem;
    border-radius: var(--app-radius-md);
    text-decoration: none;
    transition: background-color 0.15s ease;
    margin-bottom: 0.4rem;
}

.app-sidebar-user:hover {
    background-color: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

.app-sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--app-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.app-sidebar-user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
}

.app-sidebar-user-name {
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-user-sub {
    font-size: 0.65rem;
    color: var(--app-text-muted);
}

.app-sidebar-secondary-links {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.app-sidebar-secondary-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
}

.app-sidebar-secondary-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
}

.app-sidebar-auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-app-primary,
.btn-app-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem;
    border-radius: var(--app-radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
}

.btn-app-primary {
    background-color: var(--app-accent);
    color: #fff;
}

.btn-app-primary:hover {
    background-color: var(--app-accent-hover);
    color: #fff;
    text-decoration: none;
}

.btn-app-outline {
    background-color: var(--app-panel-bg-alt);
    border: 1px solid var(--app-border-lifted);
    color: #e2e8f0;
}

.btn-app-outline:hover {
    background-color: var(--app-border-lifted);
    color: #fff;
    text-decoration: none;
}

/* ---------- 5. Top header bar (matches reference Header.tsx) ---------- */
.app-topbar {
    height: var(--app-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem;
    background-color: var(--app-panel-bg);
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    z-index: 30;
    flex-shrink: 0;
}

.app-mobile-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--app-radius-sm);
    background-color: var(--app-panel-bg-alt);
    border: 1px solid var(--app-border-lifted);
    color: var(--app-text);
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-width: 0;
}

.app-topbar-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
    margin: 0;
}

.app-topbar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 16rem;
    background-color: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    padding: 0.4rem 0.75rem;
    color: var(--app-text-muted);
}

.app-topbar-search:focus-within {
    border-color: var(--app-accent);
}

.app-topbar-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--app-text);
    font-size: 0.75rem;
}

.app-topbar-search-input::placeholder {
    color: var(--app-text-muted);
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.app-topbar-icon-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: var(--app-radius-md);
    background-color: var(--app-panel-bg-alt);
    border: 1px solid var(--app-border-lifted);
    color: var(--app-text);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.app-topbar-icon-btn:hover {
    background-color: var(--app-border-lifted);
    color: #fff;
    text-decoration: none;
}

.app-topbar-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background-color: var(--app-accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-topbar-badge-alert {
    background-color: var(--app-accent);
}

/* Wallet card */
.app-topbar-wallet {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-md);
    padding: 0.4rem 0.9rem;
    text-decoration: none;
}

.app-topbar-wallet:hover {
    border-color: var(--app-border-lifted);
    text-decoration: none;
}

.app-topbar-wallet-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.app-topbar-wallet-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--app-text-muted);
    text-transform: uppercase;
}

.app-topbar-wallet-amount {
    font-size: 0.75rem;
    font-weight: 800;
    color: #34d399;
}

.app-topbar-wallet-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background-color: var(--app-panel-bg-alt);
    border: 1px solid var(--app-border-lifted);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.3rem 0.55rem;
    border-radius: var(--app-radius-sm);
}

.app-topbar-wallet-btn .app-icon {
    color: #34d399;
}

/* Create server button */
.app-topbar-createbtn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background-color: var(--app-accent);
    color: #fff;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 0.55rem 0.9rem;
    border-radius: var(--app-radius-md);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
    text-decoration: none;
    flex-shrink: 0;
}

.app-topbar-createbtn:hover {
    background-color: var(--app-accent-hover);
    color: #fff;
    text-decoration: none;
}

/* ---------- 6. Content area ---------- */
.app-breadcrumb {
    background-color: transparent;
    padding: 0.5rem 0;
}

.app-content {
    flex: 1;
    padding: 1.25rem;
}

.app-footer {
    border-top: 1px solid var(--app-border);
    padding: 1.25rem 0;
    color: var(--app-text-muted);
    font-size: 0.8rem;
}

.app-footer a {
    color: var(--app-text-muted);
}

/* ---------- 7. Cards / panels adapt to dark tokens automatically ---------- */
.card,
.panel,
.card-sidebar {
    background-color: var(--app-panel-bg-alt);
    border-color: var(--app-border);
}

/* ---------- 8. Responsive: collapse to off-canvas sidebar ---------- */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(100%);
        box-shadow: -10px 0 30px rgba(0,0,0,0.4);
    }

    .app-shell.is-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    .app-main {
        margin-right: 0 !important;
    }

    .app-sidebar-toggle {
        display: none;
    }

    .app-mobile-toggle {
        display: flex;
    }

    .app-topbar-search {
        max-width: none;
    }
}

@media (max-width: 1100px) {
    .app-topbar-search {
        display: none;
    }
}

@media (max-width: 640px) {
    .app-topbar-wallet-info { display: none; }
    .app-topbar-createbtn-label { display: none; }
    /* قبلاً ۱۴۰ پیکسل بود و عنوان‌های فارسی رو وسط کلمه می‌برید.
       حالا عنوان توی ستون خودشه، پس می‌تونه پهن‌تر باشه. */
    .app-topbar-title { max-width: 100%; }
}

/* ---------- 9. Inline SVG icons (font-independent) & rebuilt sidebar bits ---------- */
.app-icon {
    width: 1.1rem !important;
    height: 1.1rem !important;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.app-icon-xs {
    width: 0.7rem !important;
    height: 0.7rem !important;
}

.app-sidebar-brand-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.app-sidebar-quick-add {
    width: 32px;
    height: 32px;
    border-radius: var(--app-radius-sm);
    background-color: var(--app-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.app-sidebar-quick-add:hover {
    background-color: var(--app-accent-hover);
    color: #fff;
    text-decoration: none;
}

.app-nav-badge.badge-amber {
    background-color: #f59e0b;
    color: #1a1206;
}

.app-sidebar-user-avatar i {
    font-style: normal;
}

.app-sidebar-user-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding-top: 0.5rem;
    margin-top: 0.3rem;
    border-top: 1px solid var(--app-border);
    font-size: 0.65rem;
}

.app-sidebar-user-id-label {
    color: var(--app-text-muted);
}

.app-sidebar-user-id {
    font-family: 'JetBrains Mono', monospace;
    color: #e2e8f0;
    font-weight: 700;
}

.app-sidebar-logout {
    margin-right: auto;
    color: var(--app-text-muted);
    padding: 0.2rem;
    border-radius: var(--app-radius-sm);
}

.app-sidebar-logout:hover {
    color: #fb7185;
    background-color: rgba(255,255,255,0.05);
}

.btn-app-primary .app-icon,
.btn-app-outline .app-icon {
    width: 0.9rem;
    height: 0.9rem;
}

/* ---------- 10. Auth pages: no sidebar, full-width centered layout ---------- */
.app-shell.is-auth-page .app-main {
    margin-right: 0 !important;
}

.app-shell.is-auth-page .app-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* ---------- 11. مودال شناور برای صفحه سفارش (بدون خروج از پنل) ---------- */
.ob-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
}

.ob-modal-overlay.open {
    display: flex;
}

.ob-modal-box {
    position: relative;
    width: 100%;
    max-width: 1100px;
    height: 90vh;
    background: var(--app-bg, #0b0f19);
    border: 1px solid var(--app-border-lifted, #334155);
    border-radius: 1.25rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.ob-modal-close {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 34px;
    height: 34px;
    border-radius: 0.6rem;
    background: var(--app-panel-bg-alt, #161b26);
    border: 1px solid var(--app-border-lifted, #334155);
    color: #e2e8f0;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
}

.ob-modal-close:hover {
    background: var(--app-border-lifted, #334155);
    color: #fff;
}

.ob-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

@media (max-width: 768px) {
    .ob-modal-overlay { padding: 0; }
    .ob-modal-box { max-width: 100%; height: 100vh; border-radius: 0; }
}

/* ---------- پاپ‌آپ اطلاعیه/تخفیف (از ماژول Order Builder مدیریت می‌شه) ---------- */
.ob-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem 1.25rem;
}
.ob-popup-overlay.open {
    display: flex;
    animation: obPopupFadeIn .25s ease;
}
@keyframes obPopupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes obPopupScaleIn {
    from { opacity: 0; transform: translateY(12px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ob-popup-box {
    width: min(92vw, 34rem);
    max-height: min(88vh, 640px);
    overflow-y: auto;
    background: linear-gradient(180deg, var(--app-panel-bg-alt) 0%, var(--app-panel-bg) 100%);
    border: 1px solid var(--app-border-lifted);
    border-radius: 1.4rem;
    padding: 0;
    position: relative;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,.03) inset;
    text-align: center;
    animation: obPopupScaleIn .3s cubic-bezier(.2,.8,.2,1);
}
.ob-popup-box::before {
    content: '';
    display: block;
    height: 5px;
    width: 100%;
    background: linear-gradient(90deg, var(--ob-accent, var(--app-accent)), transparent 140%);
    border-radius: 1.4rem 1.4rem 0 0;
}
.ob-popup-box-inner {
    padding: 2.25rem 2rem 2rem;
}
.ob-popup-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, .16);
    background: color-mix(in srgb, var(--ob-accent, var(--app-accent)) 16%, transparent);
    color: var(--ob-accent, var(--app-accent));
    font-size: 1.5rem;
    font-weight: 800;
}
.ob-popup-box h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 .75rem;
    line-height: 1.5;
}
.ob-popup-box p,
.ob-popup-message {
    font-size: .88rem;
    line-height: 1.9;
    color: var(--app-text);
    margin: 0 0 1.5rem;
}
.ob-popup-message img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
    margin: .9rem 0;
    box-shadow: 0 20px 45px rgba(0,0,0,.4);
    border: 1px solid var(--app-border-lifted);
}
.ob-popup-message a {
    color: #60a5fa;
    text-decoration: underline;
}
.ob-popup-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--app-border-lifted);
    color: var(--app-text-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: .15s ease;
}
.ob-popup-close:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
    transform: rotate(90deg);
}
.ob-popup-box .ob-announce-btn {
    display: inline-block;
    padding: .8rem 2.2rem;
    font-size: .85rem;
    font-weight: 800;
    border-radius: .85rem;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .3);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--ob-accent, var(--app-accent)) 40%, transparent);
}

.ob-popup-box.ob-announce-info { --ob-accent: #2563eb; }
.ob-popup-box.ob-announce-success { --ob-accent: #059669; }
.ob-popup-box.ob-announce-warning { --ob-accent: #d97706; }
.ob-popup-box.ob-announce-danger { --ob-accent: #e11d48; }

@media (max-width: 480px) {
    .ob-popup-box-inner { padding: 1.75rem 1.25rem 1.5rem; }
    .ob-popup-box h3 { font-size: 1.05rem; }
}

/* ======================================================================
 * بازطراحی سایدبار
 * ======================================================================
 * بعد از تعریف‌های بالا میاد، پس با اولویت برابر برنده‌ست و لازم نیست
 * قوانین قبلی حذف بشن (کمتر ریسک شکستن چیزی که ندیدم).
 * ====================================================================== */

/* ---------- عنوان بخش‌ها ---------- */

.app-nav-section {
    padding: .35rem .85rem;
    margin-top: .85rem;
    font-size: .63rem;
    font-weight: 800;
    letter-spacing: .08em;
    color: #64748b;
    text-transform: uppercase;
    user-select: none;
}

.app-sidebar-nav > .app-nav-section:first-child { margin-top: 0; }

/* توی حالت جمع‌شده به‌جای متن، یه جداکننده نازک می‌شه */
.app-shell.is-collapsed .app-nav-section {
    font-size: 0;
    padding: 0;
    margin: .7rem .9rem;
    height: 1px;
    background-color: var(--app-border);
}

/* ---------- آیتم‌های ناوبری ---------- */

.app-nav-item,
.app-nav-group-toggle {
    position: relative;
    padding: .6rem .85rem;
    font-weight: 600;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.app-nav-item:hover,
.app-nav-group-toggle:hover {
    background-color: rgba(148, 163, 184, .07);
}

/*
 * حالت فعال: به‌جای بلوک آبی پررنگ، یه پس‌زمینه ملایم با نوار لهجه
 * روی لبه بیرونی. توی RTL لبه شروع سمت راسته، یعنی همون لبه‌ای که به
 * کناره سایدبار می‌چسبه.
 */
.app-nav-item.active {
    background: linear-gradient(to left, rgba(37, 99, 235, .2), rgba(37, 99, 235, .05));
    color: #fff;
    border-color: rgba(59, 130, 246, .28);
    box-shadow: none;
}

.app-nav-item.active::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa, #38bdf8);
}

.app-nav-item.active .app-nav-icon {
    color: #60a5fa;
    opacity: 1;
}

.app-nav-item .app-nav-icon { transition: color .15s ease, opacity .15s ease; }
.app-nav-item:hover .app-nav-icon { opacity: 1; }

/* ---------- نشان‌ها ---------- */

.app-nav-badge {
    min-width: 1.35rem;
    text-align: center;
    padding: .12rem .45rem;
    background-color: rgba(148, 163, 184, .16);
    color: #cbd5e1;
    border: 1px solid transparent;
}

.app-nav-item.active .app-nav-badge {
    background-color: rgba(96, 165, 250, .22);
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, .3);
}

.app-nav-badge.badge-amber {
    background-color: rgba(245, 158, 11, .16);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, .3);
}

.app-nav-badge.badge-danger {
    background-color: rgba(244, 63, 94, .16);
    color: #fb7185;
    border-color: rgba(244, 63, 94, .3);
}

/*
 * حالت جمع‌شده: نشان به‌جای عدد، یه نقطه کوچیک روی گوشه آیکن می‌شه تا
 * همچنان بفهمی چیزی هست. قانون قبلی کلاً display:none می‌کرد.
 */
.app-shell.is-collapsed .app-nav-badge {
    display: block;
    position: absolute;
    top: .45rem;
    inset-inline-end: .55rem;
    width: .45rem;
    height: .45rem;
    min-width: 0;
    padding: 0;
    font-size: 0;
    border-radius: 50%;
    background-color: #60a5fa;
    border: none;
}

.app-shell.is-collapsed .app-nav-badge.badge-amber { background-color: #fbbf24; }
.app-shell.is-collapsed .app-nav-badge.badge-danger { background-color: #fb7185; }

/* ---------- ناوبری: اسکرول‌بار باریک ---------- */

.app-sidebar-nav {
    padding: .85rem .6rem 1rem;
    gap: .2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--app-border-lifted) transparent;
}

.app-sidebar-nav::-webkit-scrollbar { width: 6px; }
.app-sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.app-sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--app-border-lifted);
    border-radius: 999px;
}
.app-sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: #475569; }

/* ---------- زیرآیتم‌ها ---------- */

.app-nav-subitem {
    position: relative;
    font-weight: 500;
}

.app-nav-subitem.active {
    color: #fff;
    background-color: rgba(37, 99, 235, .14);
}

/* ---------- بخش برند ---------- */

.app-sidebar-brand { padding: 1.1rem 1rem; }

.app-sidebar-brand-name {
    font-size: .82rem;
    letter-spacing: .01em;
}

.app-sidebar-brand-sub {
    color: #60a5fa;
    letter-spacing: .04em;
}

.app-sidebar-toggle { transition: background-color .15s ease, color .15s ease; }

/* ---------- پاورقی ---------- */

.app-sidebar-footer {
    padding: .85rem;
    border-top: 1px solid var(--app-border);
    background-color: rgba(0, 0, 0, .18);
}

.app-sidebar-user {
    border-radius: var(--app-radius-md);
    padding: .55rem;
    transition: background-color .15s ease;
}

.app-sidebar-user:hover { background-color: rgba(148, 163, 184, .08); }

@media (prefers-reduced-motion: reduce) {
    .app-nav-item,
    .app-nav-group-toggle,
    .app-nav-item .app-nav-icon,
    .app-sidebar-user,
    .app-sidebar-toggle { transition: none; }
}

/* ======================================================================
 * بازطراحی نوار بالا
 * ====================================================================== */

.app-topbar {
    height: auto;
    min-height: var(--app-header-height);
    padding: .7rem 1.25rem;
    background-color: rgba(19, 23, 34, .85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--app-border);
}

/* ستون راست: عنوان + مسیر راهنما زیرش */
.app-topbar-right {
    flex-direction: column;
    align-items: flex-start;
    gap: .2rem;
}

.app-topbar-title {
    font-size: .95rem;
    letter-spacing: -.01em;
    max-width: 100%;
    line-height: 1.6;
}

/* ---------- مسیر راهنما ---------- */

.app-topbar-crumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .3rem;
    font-size: .68rem;
    color: #64748b;
    line-height: 1.6;
}

.app-topbar-crumbs a {
    color: #94a3b8;
    text-decoration: none;
    transition: color .15s ease;
}

.app-topbar-crumbs a:hover { color: var(--app-accent-hover); text-decoration: none; }

.app-topbar-crumbs > span { color: #64748b; }

/* جداکننده در RTL باید برعکس بشه */
.app-crumb-sep {
    color: #475569;
    flex-shrink: 0;
    transform: scaleX(-1);
}

/* ---------- کیف پول ---------- */

.app-topbar-wallet {
    padding: .35rem .35rem .35rem .85rem;
    transition: border-color .15s ease, background-color .15s ease;
}

.app-topbar-wallet:hover {
    border-color: rgba(52, 211, 153, .35);
    background-color: rgba(16, 185, 129, .06);
}

.app-topbar-wallet-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: .62rem;
}

.app-topbar-wallet-amount {
    font-size: .8rem;
    white-space: nowrap;
}

.app-topbar-wallet-btn {
    border-radius: var(--app-radius-sm);
    padding: .35rem .6rem;
    transition: background-color .15s ease;
}

.app-topbar-wallet:hover .app-topbar-wallet-btn {
    background-color: rgba(16, 185, 129, .16);
    border-color: rgba(52, 211, 153, .35);
}

/* ---------- دکمه‌های آیکنی ---------- */

.app-topbar-icon-btn {
    position: relative;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.app-topbar-icon-btn:hover {
    border-color: var(--app-border-lifted);
    color: #fff;
}

/* ---------- دکمه ایجاد سرویس ---------- */

.app-topbar-createbtn {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border: none;
    box-shadow: 0 8px 20px rgba(37, 99, 235, .25);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.app-topbar-createbtn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(37, 99, 235, .33);
}

.app-topbar-createbtn:active { transform: translateY(0); }

/* ---------- موبایل ---------- */

@media (max-width: 767px) {
    .app-topbar { padding: .6rem .85rem; gap: .6rem; }
    .app-topbar-title { font-size: .85rem; }
    .app-topbar-crumbs { display: none; }
    .app-topbar-wallet-info { display: none; }
    .app-topbar-wallet { padding: .35rem; }
    .app-topbar-createbtn-label { display: none; }
    .app-topbar-createbtn { padding: .5rem .65rem; }
}

@media (prefers-reduced-motion: reduce) {
    .app-topbar-wallet,
    .app-topbar-wallet-btn,
    .app-topbar-icon-btn,
    .app-topbar-createbtn,
    .app-topbar-crumbs a { transition: none; }
    .app-topbar-createbtn:hover { transform: none; }
}

/* ---------- نشان برند: حالا SVG می‌گیره نه حرف ---------- */

.app-sidebar-brand-mark .brand-mark-svg,
.auth-head-mark .brand-mark-svg,
.auth-showcase-mark .brand-mark-svg {
    width: auto;
    height: auto;
    color: #fff;
    opacity: .95;
}

/* ---------- پرده پشت کشوی موبایل ---------- */

@media (max-width: 991px) {
    .app-shell.is-mobile-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background-color: rgba(3, 7, 18, .6);
        backdrop-filter: blur(2px);
        z-index: 35;   /* زیر سایدبار (۴۰)، روی محتوا */
        animation: app-fade-in .2s ease;
    }

    .app-sidebar { z-index: 45; }
}

@keyframes app-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .app-shell.is-mobile-open::after { animation: none; }
}
