:root {
    --amer-bg: #f4f7fb;
    --amer-surface: rgba(255, 255, 255, .88);
    --amer-surface-strong: #ffffff;
    --amer-border: rgba(15, 23, 42, .08);
    --amer-text: #101828;
    --amer-muted: #667085;
    --amer-primary: #1769e0;
    --amer-primary-soft: rgba(23, 105, 224, .10);
    --amer-success: #16875f;
    --amer-danger: #c74454;
    --amer-warning: #d18c16;
    --amer-sidebar-width: 270px;
    --amer-sidebar-collapsed-width: 84px;
    --amer-topbar-height: 76px;
    --amer-radius-sm: 12px;
    --amer-radius-md: 16px;
    --amer-radius-lg: 22px;
    --amer-shadow-sm: 0 4px 14px rgba(15, 23, 42, .04);
    --amer-shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
}

html[data-theme="dark"] {
    --amer-bg: #07111f;
    --amer-surface: rgba(15, 23, 42, .80);
    --amer-surface-strong: #0c1727;
    --amer-border: rgba(255, 255, 255, .07);
    --amer-text: #f8fafc;
    --amer-muted: #94a3b8;
    --amer-primary-soft: rgba(59, 130, 246, .16);
    --amer-shadow-sm: 0 4px 14px rgba(0, 0, 0, .12);
    --amer-shadow-md: 0 12px 32px rgba(0, 0, 0, .22);
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: radial-gradient( circle at top right, rgba(23, 105, 224, .06), transparent 34% ), var(--amer-bg);
    color: var(--amer-text);
    font-family: "Vazirmatn", sans-serif;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font-family: inherit;
}


/* =========================================================
   MAIN SHELL
   ========================================================= */

.amer-shell {
    min-height: 100vh;
    display: flex;
    direction: rtl;
}

.amer-main-v4 {
    width: calc(100% - var(--amer-sidebar-width));
    margin-right: var(--amer-sidebar-width);
    min-width: 0;
    transition: width .22s ease, margin .22s ease;
}

body.amer-sidebar-collapsed
.amer-main-v4 {
    width: calc( 100% - var(--amer-sidebar-collapsed-width) );
    margin-right: var(--amer-sidebar-collapsed-width);
}


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

.amer-sidebar-v4 {
    position: fixed;
    z-index: 1030;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--amer-sidebar-width);
    display: flex;
    flex-direction: column;
    background: linear-gradient( 180deg, rgba(255,255,255,.98), rgba(248,250,252,.94) );
    border-left: 1px solid var(--amer-border);
    backdrop-filter: blur(18px);
    box-shadow: -8px 0 28px rgba(15, 23, 42, .035);
    transition: width .22s ease;
}

html[data-theme="dark"]
.amer-sidebar-v4 {
    background: linear-gradient( 180deg, rgba(10,20,35,.96), rgba(7,17,31,.97) );
}

body.amer-sidebar-collapsed
.amer-sidebar-v4 {
    width: var(--amer-sidebar-collapsed-width);
}


/* =========================================================
   BRAND
   ========================================================= */

.amer-sidebar-brand {
    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    border-bottom: 1px solid var(--amer-border);
}

.amer-brand-link {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}

.amer-logo-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient( 145deg, #1769e0, #0a4ea8 );
    color: #fff;
    font-size: 19px;
    font-weight: 900;
    box-shadow: 0 7px 18px rgba(23, 105, 224, .24);
}

.amer-brand-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

    .amer-brand-copy strong {
        font-size: 15px;
        font-weight: 900;
    }

    .amer-brand-copy span {
        margin-top: 1px;
        color: var(--amer-muted);
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.amer-sidebar-collapse-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 0;
    border-radius: 11px;
    background: rgba(15, 23, 42, .05);
    color: var(--amer-text);
    font-size: 18px;
    cursor: pointer;
    transition: .18s ease;
}

    .amer-sidebar-collapse-btn:hover {
        background: var(--amer-primary-soft);
        color: var(--amer-primary);
    }

body.amer-sidebar-collapsed
.amer-brand-copy {
    display: none;
}

body.amer-sidebar-collapsed
.amer-sidebar-brand {
    justify-content: center;
    padding-inline: 10px;
}

body.amer-sidebar-collapsed
.amer-sidebar-collapse-btn {
    position: absolute;
    left: -14px;
    top: 22px;
    box-shadow: var(--amer-shadow-sm);
}


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

.amer-sidebar-scroll {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 10px 18px;
    scrollbar-width: thin;
}

    .amer-sidebar-scroll::-webkit-scrollbar {
        width: 5px;
    }

    .amer-sidebar-scroll::-webkit-scrollbar-thumb {
        background: rgba(100, 116, 139, .18);
        border-radius: 999px;
    }


/* =========================================================
   NAV GROUP
   ========================================================= */

.amer-nav-group {
    margin-bottom: 18px;
}

.amer-nav-group-title {
    margin: 0 9px 7px;
    color: var(--amer-muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .6px;
    opacity: .75;
}

body.amer-sidebar-collapsed
.amer-nav-group-title {
    display: none;
}

.amer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}


/* =========================================================
   NAV ITEM
   ========================================================= */

.amer-nav-item {
    position: relative;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: 13px;
    color: var(--amer-muted);
    text-decoration: none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

    .amer-nav-item:hover {
        background: rgba(15, 23, 42, .035);
        color: var(--amer-text);
        transform: translateX(-2px);
    }

html[data-theme="dark"]
.amer-nav-item:hover {
    background: rgba(255, 255, 255, .04);
}

.amer-nav-item.active {
    background: linear-gradient( 90deg, rgba(23, 105, 224, .14), rgba(23, 105, 224, .06) );
    color: var(--amer-primary);
    font-weight: 800;
}

    .amer-nav-item.active::before {
        content: "";
        position: absolute;
        right: -10px;
        top: 8px;
        bottom: 8px;
        width: 3px;
        border-radius: 99px;
        background: var(--amer-primary);
    }

.amer-nav-item-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(15, 23, 42, .045);
    color: inherit;
    font-size: 13px;
}

html[data-theme="dark"]
.amer-nav-item-icon {
    background: rgba(255, 255, 255, .045);
}

.amer-nav-item.active
.amer-nav-item-icon {
    background: var(--amer-primary-soft);
    color: var(--amer-primary);
}

.amer-nav-item-text {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amer-nav-badge {
    flex: 0 0 auto;
    min-width: 24px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(23, 105, 224, .10);
    color: var(--amer-primary);
    font-size: 8px;
    font-weight: 900;
    text-align: center;
}

body.amer-sidebar-collapsed
.amer-nav-item {
    justify-content: center;
    padding-inline: 8px;
}

body.amer-sidebar-collapsed
.amer-nav-item-text,
body.amer-sidebar-collapsed
.amer-nav-badge {
    display: none;
}

body.amer-sidebar-collapsed
.amer-nav-item.active::before {
    right: -10px;
}


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

.amer-sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px;
    border-top: 1px solid var(--amer-border);
}

.amer-sidebar-user-link {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
}

.amer-sidebar-avatar,
.amer-topbar-avatar,
.amer-mobile-avatar {
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient( 145deg, #111827, #344054 );
    color: #fff;
    font-weight: 900;
}

.amer-sidebar-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}

.amer-sidebar-user-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

    .amer-sidebar-user-copy strong {
        font-size: 11px;
        font-weight: 900;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .amer-sidebar-user-copy span {
        margin-top: 2px;
        color: var(--amer-muted);
        font-size: 9px;
    }

.amer-sidebar-logout-form {
    margin: 0;
}

.amer-sidebar-logout-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 11px;
    background: rgba(199, 68, 84, .08);
    color: var(--amer-danger);
    cursor: pointer;
}

body.amer-sidebar-collapsed
.amer-sidebar-user-copy,
body.amer-sidebar-collapsed
.amer-sidebar-logout-form {
    display: none;
}

body.amer-sidebar-collapsed
.amer-sidebar-user {
    justify-content: center;
}


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

.amer-topbar-v4 {
    position: sticky;
    z-index: 1000;
    top: 0;
    min-height: var(--amer-topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--amer-border);
    background: rgba(244, 247, 251, .76);
    backdrop-filter: blur(18px);
}

html[data-theme="dark"]
.amer-topbar-v4 {
    background: rgba(7, 17, 31, .74);
}

.amer-topbar-title {
    min-width: 0;
}

.amer-topbar-eyebrow {
    margin-bottom: 2px;
    color: var(--amer-primary);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .8px;
}

.amer-topbar-title h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.amer-topbar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.amer-topbar-action {
    position: relative;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--amer-border);
    border-radius: 12px;
    background: var(--amer-surface);
    color: var(--amer-text);
    text-decoration: none;
    font-size: 14px;
    box-shadow: var(--amer-shadow-sm);
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

    .amer-topbar-action:hover {
        transform: translateY(-1px);
        background: var(--amer-primary-soft);
        color: var(--amer-primary);
    }

.amer-topbar-profile {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-right: 3px;
    padding: 4px 5px 4px 9px;
    border: 1px solid var(--amer-border);
    border-radius: 14px;
    background: var(--amer-surface);
    text-decoration: none;
    box-shadow: var(--amer-shadow-sm);
}

.amer-topbar-profile-copy {
    min-width: 90px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

    .amer-topbar-profile-copy strong {
        max-width: 130px;
        font-size: 10px;
        font-weight: 900;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .amer-topbar-profile-copy span {
        color: var(--amer-muted);
        font-size: 8px;
    }

.amer-topbar-avatar {
    width: 32px;
    height: 32px;
    font-size: 11px;
}


/* =========================================================
   NOTIFICATION BADGES
   ========================================================= */

.amer-notification-button {
    position: relative;
}

.amer-notification-badge,
.amer-mobile-notification-badge,
.amer-bottom-notification-badge {
    position: absolute;
    display: grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border: 2px solid var(--amer-surface-strong);
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 7px;
    font-weight: 900;
    line-height: 1;
}

.amer-notification-badge {
    top: -5px;
    left: -5px;
}

.amer-mobile-notification-badge {
    top: -4px;
    left: -4px;
}

.amer-bottom-notification-badge {
    top: 3px;
    left: 50%;
    margin-left: -22px;
}


/* =========================================================
   PAGE
   ========================================================= */

.amer-page-v4 {
    width: 100%;
    padding: 22px 24px 40px;
}


/* =========================================================
   MOBILE HEADER
   ========================================================= */

.amer-mobile-header-v4 {
    display: none;
}

.amer-mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.amer-mobile-notification-button {
    position: relative;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--amer-border);
    border-radius: 11px;
    background: var(--amer-surface);
    text-decoration: none;
    font-size: 13px;
}

.amer-mobile-avatar {
    width: 36px;
    height: 36px;
    text-decoration: none;
    font-size: 11px;
}


/* =========================================================
   MOBILE DRAWER
   ========================================================= */

.amer-mobile-overlay {
    position: fixed;
    z-index: 1090;
    inset: 0;
    display: none;
    background: rgba(2, 6, 23, .48);
    backdrop-filter: blur(4px);
}

    .amer-mobile-overlay.open {
        display: block;
    }

.amer-mobile-drawer {
    position: fixed;
    z-index: 1100;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 360px);
    padding: 16px;
    background: var(--amer-surface-strong);
    box-shadow: -20px 0 60px rgba(15, 23, 42, .18);
    transform: translateX(105%);
    transition: transform .22s ease;
}

    .amer-mobile-drawer.open {
        transform: translateX(0);
    }

.amer-mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

    .amer-mobile-drawer-head > div {
        display: flex;
        flex-direction: column;
    }

    .amer-mobile-drawer-head strong {
        font-size: 14px;
        font-weight: 900;
    }

    .amer-mobile-drawer-head span {
        margin-top: 2px;
        color: var(--amer-muted);
        font-size: 9px;
    }

    .amer-mobile-drawer-head button {
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 11px;
        background: rgba(15, 23, 42, .05);
        color: var(--amer-text);
        font-size: 18px;
    }

.amer-mobile-drawer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

    .amer-mobile-drawer-grid a {
        min-height: 84px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 7px;
        border: 1px solid var(--amer-border);
        border-radius: 15px;
        background: var(--amer-surface);
        text-align: center;
        text-decoration: none;
        font-size: 9px;
        font-weight: 800;
        box-shadow: var(--amer-shadow-sm);
    }

        .amer-mobile-drawer-grid a span {
            font-size: 18px;
        }

        .amer-mobile-drawer-grid a:active {
            transform: scale(.97);
        }


/* =========================================================
   BOTTOM NAV
   ========================================================= */

.amer-bottom-nav-v4 {
    display: none;
}


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

@media (max-width: 991.98px) {

    body {
        padding-bottom: calc( 72px + env(safe-area-inset-bottom) );
    }


    .amer-sidebar-v4,
    .amer-topbar-v4 {
        display: none;
    }


    .amer-main-v4,
    body.amer-sidebar-collapsed
    .amer-main-v4 {
        width: 100%;
        margin-right: 0;
    }


    .amer-mobile-header-v4 {
        position: sticky;
        z-index: 1020;
        top: 0;
        min-height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 9px 13px;
        border-bottom: 1px solid var(--amer-border);
        background: rgba(244,247,251,.84);
        backdrop-filter: blur(18px);
    }


    html[data-theme="dark"]
    .amer-mobile-header-v4 {
        background: rgba(7,17,31,.84);
    }


    .amer-mobile-menu-btn {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border: 0;
        border-radius: 12px;
        background: var(--amer-surface);
        color: var(--amer-text);
        font-size: 15px;
        box-shadow: var(--amer-shadow-sm);
    }


    .amer-mobile-brand-link {
        min-width: 0;
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        text-decoration: none;
    }


    .amer-mobile-logo {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        display: grid;
        place-items: center;
        border-radius: 11px;
        background: linear-gradient( 145deg, #1769e0, #0b4ea5 );
        color: #fff;
        font-size: 13px;
        font-weight: 900;
    }


    .amer-mobile-brand-link > div:last-child {
        min-width: 0;
        display: flex;
        flex-direction: column;
    }


    .amer-mobile-brand-link strong {
        font-size: 11px;
        font-weight: 900;
    }


    .amer-mobile-brand-link span {
        color: var(--amer-muted);
        font-size: 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }


    .amer-page-v4 {
        padding: 14px 12px 24px;
    }


    .amer-bottom-nav-v4 {
        position: fixed;
        z-index: 1050;
        right: 10px;
        left: 10px;
        bottom: calc( 8px + env(safe-area-inset-bottom) );
        min-height: 58px;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: center;
        padding: 5px 5px;
        border: 1px solid var(--amer-border);
        border-radius: 20px;
        background: rgba(255,255,255,.88);
        backdrop-filter: blur(20px);
        box-shadow: 0 12px 35px rgba(15, 23, 42, .14);
    }


    html[data-theme="dark"]
    .amer-bottom-nav-v4 {
        background: rgba(12,23,39,.90);
    }


    .amer-bottom-item-v4 {
        position: relative;
        min-width: 0;
        min-height: 46px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border: 0;
        border-radius: 14px;
        background: transparent;
        color: var(--amer-muted);
        text-decoration: none;
        font-family: inherit;
    }


        .amer-bottom-item-v4 > span:first-child {
            font-size: 15px;
            line-height: 1;
        }


        .amer-bottom-item-v4 small {
            font-size: 7.5px;
            font-weight: 800;
        }


        .amer-bottom-item-v4.active {
            color: var(--amer-primary);
            background: var(--amer-primary-soft);
        }


    .amer-bottom-item-v4--primary {
        color: #fff;
        background: linear-gradient( 145deg, #1769e0, #0b4fa8 );
        box-shadow: 0 8px 18px rgba(23, 105, 224, .24);
    }


        .amer-bottom-item-v4--primary.active {
            color: #fff;
            background: linear-gradient( 145deg, #1769e0, #0b4fa8 );
        }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 520px) {

    .amer-mobile-drawer-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

        .amer-mobile-drawer-grid a {
            min-height: 78px;
        }
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
