:root {
    --sidebar-width: 270px;
    --shell-bg: #f5f7fb;
    --panel-bg: #ffffff;
    --line: #e9ecef;
    --text-main: #212529;
    --text-muted: #6c757d;
    --primary: #0d6efd;
    --primary-soft: #eef4ff;
    --primary-soft-2: #dbe8ff;
    --radius-xl: 18px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.05);
}

html,
body {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--shell-bg);
    color: var(--text-main);
}

img {
    max-width: 100%;
    height: auto;
}

/* =========================
   SHELL LAYOUT
========================= */

.dashboard-shell {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    gap: 0 !important;
    background: var(--shell-bg);
}

.dashboard-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--panel-bg);
    border-left: 1px solid var(--line);
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

.dashboard-content {
    flex: 1 1 0%;
    min-width: 0;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}

.dashboard-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0 !important;
}

.dashboard-page-content {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

.dashboard-page-content > .container-fluid,
.dashboard-page-content > .container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.dashboard-page-content > .container-fluid {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

/* خنثی‌سازی استایل‌های قدیمی */
.sidebar {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-height: auto !important;
    height: auto !important;
    right: auto !important;
    left: auto !important;
    background: transparent !important;
    border: 0 !important;
    transition: none !important;
}

.content {
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-height: auto !important;
    background: transparent !important;
    transition: none !important;
}

/* =========================
   TOPBAR / NAVBAR
========================= */

.dashboard-topbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.dashboard-topbar-inner {
    min-height: 78px;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-topbar-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-soft);
}

.dashboard-topbar-user {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text-main);
}

.dashboard-topbar-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef4ff 0%, #dbe8ff 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    overflow: hidden;
    padding: 6px;
}

.dashboard-topbar-avatar .avatar-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 767.98px) {
    .dashboard-topbar-avatar {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        padding: 3px !important;
        border-radius: 7px !important;
    }

    .dashboard-topbar-avatar .avatar-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        border-radius: 3px !important;
    }

    .dashboard-topbar-usertext strong {
        font-size: 11px !important;
    }

    .dashboard-topbar-usertext small {
        font-size: 9px !important;
    }
}

.dashboard-topbar-usertext strong {
    font-size: 0.95rem;
    font-weight: 800;
}

.dashboard-topbar-usertext small {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

.dashboard-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.dashboard-topbar-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #495057;
    transition: 0.2s ease;
}

.dashboard-topbar-btn:hover {
    background: #f8f9fa;
    color: var(--primary);
    border-color: var(--primary-soft-2);
}

.dashboard-dropdown-menu {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.08);
    min-width: 220px;
}

.dashboard-dropdown-menu .dropdown-item {
    padding: 0.8rem 1rem;
}

.dashboard-dropdown-menu .dropdown-item:hover {
    background: #f8f9fa;
}

/* =========================
   SIDEBAR
========================= */

.app-sidebar {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent;
}

.app-sidebar-inner {
    min-height: 100vh;
    padding: 1rem;
    margin: 0 !important;
}

.app-sidebar-brand {
    display: block;
    text-decoration: none;
    margin-bottom: 1rem;
}

.app-sidebar-brand-box {
    background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
    border: 1px solid var(--primary-soft-2);
    border-radius: 18px;
    padding: 1rem;
}

.app-sidebar-brand-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.app-sidebar-brand-subtitle {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.app-sidebar-menu-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 1rem 0 0.75rem;
    padding: 0 0.25rem;
}

.app-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: var(--text-main);
    padding: 0.9rem 1rem;
    border-radius: 16px;
    transition: all 0.2s ease;
    background: transparent;
}

.app-sidebar-link:hover {
    background: #f5f7fb;
    color: var(--primary);
}

.app-sidebar-link.is-active {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary-soft-2);
}

.app-sidebar-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f1f3f5;
    color: currentColor;
    transition: all 0.2s ease;
}

.app-sidebar-link.is-active .app-sidebar-icon {
    background: var(--primary-soft-2);
}

.app-sidebar-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.app-sidebar-text strong {
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.2;
}

.app-sidebar-text small {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    line-height: 1.2;
}

.app-sidebar-link.is-active .app-sidebar-text small {
    color: #5c7caa;
}

.app-sidebar-badge {
    flex-shrink: 0;
}

/* =========================
   MOBILE SIDEBAR
========================= */

.app-mobile-sidebar-bar {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    padding: 0.85rem 1rem;
}

.app-mobile-sidebar-brand {
    text-decoration: none;
}

.app-mobile-sidebar-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
}

.app-mobile-menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-mobile-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--line);
}

.app-mobile-offcanvas .offcanvas-title {
    font-weight: 800;
    color: var(--primary);
}

.app-mobile-sidebar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

@media (max-width: 767.98px) {
    .app-mobile-sidebar-bar {
        padding: 0.6rem 0.8rem !important;
    }

    .app-mobile-sidebar-brand {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .app-mobile-sidebar-logo {
        width: 22px !important;
        height: 22px !important;
    }

    .app-mobile-sidebar-title {
        font-size: 0.9rem !important;
        line-height: 1 !important;
    }

    .app-mobile-menu-btn {
        width: 36px !important;
        height: 36px !important;
        border-radius: 10px !important;
    }
}
.app-mobile-sidebar-brand {
    display: inline-flex;
    align-items: center;
    max-width: 170px;
    overflow: hidden;
}

.app-mobile-sidebar-logo {
    display: block;
    width: auto !important;
    height: 40px !important;
    max-width: 160px !important;
    object-fit: contain;
    flex-shrink: 1;
}

@media (max-width: 767.98px) {
    .app-mobile-sidebar-bar {
        padding: 0.7rem 0.9rem;
    }

    .app-mobile-sidebar-brand {
        max-width: 140px;
    }

    .app-mobile-sidebar-logo {
        height: 32px !important;
        max-width: 130px !important;
    }

    .app-mobile-menu-btn {
        width: 40px;
        height: 40px;
    }
}
/* =========================
   FOOTER
========================= */

.dashboard-footer {
    margin-top: auto;
    width: 100%;
    background: #111827;
    color: #fff;
    border-top: 0;
}

.dashboard-footer-inner {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.92rem;
    padding: 0 1rem;
}

/* =========================
   PANELS / TABLES / FORMS
========================= */

.bg-light.rounded,
.bg-white.rounded,
.rounded.shadow-sm {
    border-radius: var(--radius-lg) !important;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

.table td,
.table th {
    vertical-align: middle;
}

.form-control,
.form-select,
textarea,
input,
select {
    max-width: 100%;
}

.input-group .form-control {
    min-width: 0;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 991.98px) {
    .dashboard-shell {
        display: block;
    }

    .dashboard-sidebar {
        display: none;
    }

    .dashboard-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    .dashboard-topbar-inner {
        min-height: 72px;
        padding: 0 1rem;
    }

    .dashboard-page-content > .container-fluid,
    .dashboard-page-content > .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@media (min-width: 992px) {
    .app-mobile-sidebar-bar,
    .app-mobile-offcanvas {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .dashboard-topbar-card {
        padding: 0.75rem;
        border-radius: 16px;
    }

    .dashboard-topbar-usertext strong {
        font-size: 0.9rem;
    }

    .dashboard-topbar-usertext small {
        font-size: 0.74rem;
    }

    .dashboard-page-content .bg-light.rounded.p-4,
    .dashboard-page-content .bg-white.rounded.p-4,
    .dashboard-page-content .bg-light.rounded.p-5,
    .dashboard-page-content .bg-white.rounded.p-5 {
        padding: 1rem !important;
    }

    .dashboard-page-content .table {
        min-width: 720px;
    }

    .dashboard-footer-inner {
        min-height: 52px;
        font-size: 0.85rem;
        padding: 0 1rem;
    }
}