:root {
    --sidebar-width: 252px;
    --sidebar-collapsed-width: 86px;
    --header-height: 76px;
}

html[dir="rtl"] th {
    font-weight: normal;
}

* {
    box-sizing: border-box;
}

b, strong {
    font-family: var(--font-main-bold);
    font-weight: normal;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: radial-gradient(circle at 20% 10%, rgba(37, 99, 235, .12), transparent 30%), radial-gradient(circle at 85% 18%, rgba(20, 184, 166, .10), transparent 28%), var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

html[dir="rtl"] body {
    font-family: var(--font-main);
}

a {
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

/* Sidebar */
.sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--sidebar-width);
    background: radial-gradient(circle at 20% 18%, rgba(45, 212, 191, .16), transparent 32%), linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
    color: #fff;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    border-inline-end: 1px solid var(--sidebar-line);
    transition: width var(--ui-transition, 220ms ease), transform var(--ui-transition, 220ms ease);
    overflow: hidden;
}

    .sidebar::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        opacity: .42;
        background-image: url("data:image/svg+xml,%3Csvg width='330' height='760' viewBox='0 0 330 760' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M-80 74C5 28 116 16 180 84C256 165 190 260 253 346C304 416 415 408 452 505' stroke='white' stroke-opacity='.16' stroke-width='1.2'/%3E%3Cpath d='M-96 206C19 162 142 192 166 287C193 394 79 441 114 530C152 625 302 588 352 708' stroke='white' stroke-opacity='.12' stroke-width='1.2'/%3E%3Cpath d='M25 -60C80 35 70 113 139 178C220 254 352 219 398 324' stroke='white' stroke-opacity='.10' stroke-width='1.1'/%3E%3Ccircle cx='252' cy='108' r='2' fill='white' fill-opacity='.18'/%3E%3Ccircle cx='112' cy='406' r='2' fill='white' fill-opacity='.16'/%3E%3Ccircle cx='240' cy='620' r='2' fill='white' fill-opacity='.14'/%3E%3C/svg%3E");
        background-size: cover;
        background-position: center;
    }

.sidebar-header,
.sidebar-footer,
.sidebar-nav {
    position: relative;
    z-index: 1;
}

.sidebar-header {
    padding: 18px 22px 18px;
    /* min-height: 96px; */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

body.sidebar-collapsed .app-logo.logo-full {
    display: none;
}

body:not(.sidebar-collapsed) .app-logo.logo-full {
    width: 140px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 14px;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    padding: 5px;
}

body:not(.sidebar-collapsed) .app-logo.logo-min {
    display: none;
}

body.sidebar-collapsed .app-logo.logo-min {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border-radius: 14px;
    display: grid;
    place-items: center;
    /* background: linear-gradient(145deg, #5eead4, #2563eb 72%); */
    background: linear-gradient(145deg, #ffffff, #f0f4ff 72%);
    box-shadow: 0 16px 32px rgba(37, 99, 235, .35);
    position: relative;
    overflow: hidden;
    padding: 5px;
}

.app-logo.logo-min::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 54px;
    background: rgba(255, 255, 255, .24);
    transform: rotate(28deg);
    inset-inline-start: 5px;
    inset-block-start: -10px;
}

.app-logo img {
    width: 100%;
}

.brand-text {
    min-width: 0;
    white-space: nowrap;
}

    .brand-text strong {
        display: block;
        font-size: 15px;
        letter-spacing: -.2px;
        line-height: 1.45;
    }

    .brand-text span {
        display: block;
        color: rgba(255, 255, 255, .58);
        font-size: 11px;
        margin-top: 3px;
        letter-spacing: .3px;
    }

.sidebar-nav {
    padding: 10px 14px;
    flex: 1 1 auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.nav-section-title {
    color: rgba(255, 255, 255, .42);
    font-size: 11px;
    font-family: "IRANSans";
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 18px 12px 8px;
    white-space: nowrap;
}

body:not(.sidebar-collapsed) .side-link {
    gap: 12px;
}

.side-link {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, .70);
    padding: 12px 13px;
    border-radius: 15px;
    margin-bottom: 5px;
    transition: background var(--ui-transition, 220ms ease), color var(--ui-transition, 220ms ease), transform var(--ui-transition, 220ms ease);
    white-space: nowrap;
    position: relative;
}

    .side-link i {
        width: 24px;
        height: 24px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        color: rgba(255, 255, 255, .86);
        font-size: 20px;
        flex: 0 0 auto;
    }

    .side-link span {
        font-size: 13px;
    }

    .side-link:hover {
        color: #fff;
        background: rgba(255, 255, 255, .08);
        transform: translateX(0);
    }

html[dir="rtl"] .side-link:hover {
    transform: translateX(-3px);
}

html[dir="ltr"] .side-link:hover {
    transform: translateX(3px);
}

.side-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(37, 99, 235, .38), rgba(20, 184, 166, .22));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .11);
}

    .side-link.active::before {
        content: "";
        position: absolute;
        inset-block: 12px;
        inset-inline-start: -14px;
        width: 4px;
        border-radius: 20px;
        background: #5eead4;
        box-shadow: 0 0 18px rgba(94, 234, 212, .65);
    }

/* Sidebar Bootstrap submenu */
.side-item {
    position: relative;
    margin-bottom: 5px;
}

.side-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    font-family: var(--font-main);
    cursor: pointer;
}

    .side-toggle:focus {
        outline: none;
        box-shadow: none;
    }

.submenu-arrow {
    margin-inline-start: auto;
    width: 20px !important;
    height: 20px !important;
    font-size: 18px !important;
    border-radius: 8px !important;
    color: rgba(255, 255, 255, .58) !important;
    transition: transform var(--ui-transition, 220ms ease), color var(--ui-transition, 220ms ease);
}

/* وقتی Bootstrap منو را باز می‌کند */
.side-toggle[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
    color: #5eead4 !important;
}

.sidebar-submenu {
    padding-inline-start: 38px;
    padding-inline-end: 8px;
    margin-top: 2px;
    margin-bottom: 8px;
}

.sub-link {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    margin-block-end: 5px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .58);
    font-size: 12px;
    transition: background var(--ui-transition, 220ms ease), color var(--ui-transition, 220ms ease), transform var(--ui-transition, 220ms ease);
}

    .sub-link::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 999px;
        background: rgba(255, 255, 255, .28);
        margin-inline-end: 9px;
        flex: 0 0 auto;
    }

    .sub-link:hover {
        color: #fff;
        background: rgba(255, 255, 255, .07);
    }

html[dir="rtl"] .sub-link:hover {
    transform: translateX(-3px);
}

html[dir="ltr"] .sub-link:hover {
    transform: translateX(3px);
}

.sub-link.active {
    color: #fff;
    background: rgba(94, 234, 212, .12);
}

    .sub-link.active::before {
        background: #5eead4;
        box-shadow: 0 0 12px rgba(94, 234, 212, .7);
    }

/* در حالت جمع‌شده، زیرمنو نمایش داده نشود */
body.sidebar-collapsed .sidebar-submenu,
body.sidebar-collapsed .submenu-arrow {
    display: none !important;
}

body.sidebar-collapsed .side-toggle {
    justify-content: center;
    padding-inline: 10px;
}

.sidebar-footer {
    padding: 5px 18px 15px;
    border-top: 1px solid var(--sidebar-line);
}

.company-logo {
    width: 92px;
    /* height: 28px; */
    margin-inline: auto;
    /* border-radius: 999px; */
    display: grid;
    place-items: center;
    font-size: 10px;
    font-family: var(--font-main-bold);
    letter-spacing: .12em;
    object-fit: cover;
}

/* Main area */
body.sidebar-collapsed .main-area {
    width: 100% !important;
}

body:not(.sidebar-collapsed) .main-area {
    width: calc(100% - var(--sidebar-width)) !important;
}

.main-area {
    min-height: 100vh;
    margin-inline-start: var(--sidebar-width);
    transition: margin-inline-start var(--ui-transition, 220ms ease);
}

.topbar {
    position: sticky;
    inset-block-start: 0;
    z-index: 1020;
    min-height: var(--header-height);
    backdrop-filter: blur(18px);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 13px clamp(16px, 2.2vw, 30px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--surface);
    border-radius: 14px;
    display: inline-grid;
    place-items: center;
    transition: transform var(--ui-transition, 220ms ease), background var(--ui-transition, 220ms ease), border-color var(--ui-transition, 220ms ease);
    position: relative;
    flex-shrink: 0;
}

    .icon-btn:hover {
        transform: translateY(-1px);
        background: var(--surface-solid);
        border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
    }

    .icon-btn i {
        font-size: 21px;
    }

.search-bar {
    min-width: 0;
    margin-inline-end: auto;
}

.header-title {
    position: relative;
    min-width: 0;
    margin-inline-end: auto;
    padding-inline-start: 10px;
    padding-block-start: 10px;
    padding-block-end: 10px;
}

    .header-title::before {
        background: linear-gradient(180deg, var(--primary, #2563eb), var(--primary-2, #14b8a6));
        border-radius: 999px;
        content: "";
        inline-size: 4px;
        inset-block: 10px;
        inset-inline-start: 0;
        position: absolute;
    }

    .header-title h1 {
        margin: 0;
        font-size: clamp(18px, 2.2vw, 24px);
        font-family: var(--font-main-bold);
        letter-spacing: -.45px;
    }

    .header-title p {
        margin: 4px 0 0;
        color: var(--muted);
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: min(720px, 62vw);
    }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-pill {
    height: 42px;
    width: min(290px, 22vw);
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    padding: 0 13px;
    color: var(--muted);
}

    .search-pill i {
        font-size: 20px;
    }

    .search-pill input {
        width: 100%;
        border: 0;
        outline: 0;
        background: transparent;
        color: var(--text);
        font-size: 13px;
    }

        .search-pill input::placeholder {
            color: var(--muted-2);
        }


.badge-dot {
    position: absolute;
    inset-block-start: -5px;
    inset-inline-end: -5px;
    min-width: 20px;
    height: 20px;
    padding-inline: 5px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #fb7185, #ef4444);
    box-shadow: 0 8px 18px rgba(239, 68, 68, .34);
    font-size: 10px;
    font-family: var(--font-main-bold);
    border: 2px solid var(--bg);
}

.profile-btn {
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px 5px 12px;
    transition: background var(--ui-transition, 220ms ease), border-color var(--ui-transition, 220ms ease), transform var(--ui-transition, 220ms ease);
}

    .profile-btn:hover {
        background: var(--surface-solid);
        border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
        transform: translateY(-1px);
    }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #2563eb, #14b8a6);
    font-size: 13px;
    font-family: var(--font-main-bold);
    flex: 0 0 auto;
}

.profile-mini {
    text-align: start;
    line-height: 1.2;
    white-space: nowrap;
}

    .profile-mini strong {
        display: block;
        font-size: 12px;
    }

    .profile-mini span {
        display: block;
        font-size: 10.5px;
        color: var(--muted);
        margin-top: 3px;
    }

.floating-menu {
    position: absolute;
    inset-block-start: calc(100% + 10px);
    inset-inline-end: 0;
    width: 320px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--ui-shadow-menu, 0 24px 70px rgba(15, 23, 42, .16));
    padding: 10px;
    display: none;
    z-index: 1060;
}

    .floating-menu.show {
        display: block;
        animation: fadeUp .16s ease both;
    }

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-anchor {
    position: relative;
}

.user-menu-head {
    padding: 12px;
    border-radius: 16px;
    background: var(--surface-alt);
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

    .user-menu-head .avatar {
        width: 42px;
        height: 42px;
        border-radius: 15px;
    }

    .user-menu-head strong {
        display: block;
        font-size: 13px;
        color: var(--text);
    }

    .user-menu-head span {
        display: block;
        color: var(--muted);
        font-size: 12px;
        margin-top: 4px;
    }

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 11px 12px;
    border-radius: 14px;
    text-align: start;
    font-size: 13px;
    font-family: "IRANSans";
    transition: background var(--ui-transition, 220ms ease);
}

    .menu-item:hover {
        background: var(--surface-alt);
    }

    .menu-item i {
        font-size: 19px;
        color: var(--muted);
    }

    .menu-item.danger {
        color: var(--danger);
    }

        .menu-item.danger i {
            color: var(--danger);
        }

.notification-list {
    display: grid;
    gap: 7px;
}

.notif-item {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 15px;
    background: transparent;
    border: 1px solid transparent;
    transition: background var(--ui-transition, 220ms ease), border-color var(--ui-transition, 220ms ease);
}

html[dir="rtl"] .notif-item {
    grid-template-columns: 1fr 38px;
}

html[dir="rtl"] .notif-icon {
    order: 2;
}

html[dir="rtl"] .notif-body {
    order: 1;
}

.notif-item:hover {
    background: var(--surface-alt);
    border-color: var(--border);
}

.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 19px;
}

.notif-body strong {
    display: block;
    font-size: 12.5px;
    margin-bottom: 4px;
}

.notif-body p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.7;
}

.notif-body time {
    display: block;
    margin-top: 5px;
    color: var(--muted-2);
    font-size: 10.5px;
}

.page-content {
    padding: clamp(16px, 2.2vw, 30px);
}

.page-slot {
    max-width: 1660px;
    margin-inline: auto;
}

.page-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid var(--border, rgba(124, 139, 161, .22));
    background: var(--surface, rgba(255, 255, 255, .84));
    border-radius: var(--ui-radius-md, 18px);
    padding: 10px;
    margin-block-end: 14px;
    box-shadow: var(--ui-shadow, 0 18px 45px rgba(15, 23, 42, .08));
    backdrop-filter: blur(16px);
}

.ui-card-fill-layout {
    display: flex;
    min-width: 0;
}

    .ui-card-fill-layout > .ui-card {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-width: 0;
    }

        .ui-card-fill-layout > .ui-card > .ui-card-body {
            display: flex;
            flex-direction: column;
            flex-grow: 1;
            gap: 0;
            min-height: 0;
            min-width: 0;
        }

    .ui-card-fill-layout .ui-table-wrap {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        min-height: 0;
        min-width: 0;
    }

    .ui-card-fill-layout .ui-card-fill-content {
        flex-grow: 1;
        min-height: 0;
        min-width: 0;
    }

    .ui-card-fill-layout .ui-empty-state {
        flex-grow: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

.card-bg-gradient {
    background: radial-gradient(circle at 10% 16%, color-mix(in srgb, var(--primary, #2563eb) 16%, transparent), transparent 30%), radial-gradient(circle at 82% 10%, color-mix(in srgb, var(--primary-2, #14b8a6) 14%, transparent), transparent 26%), var(--surface, #fff);
}

.section-card,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--ui-radius-lg, 24px);
    box-shadow: var(--ui-shadow, 0 18px 45px rgba(15, 23, 42, .08));
    backdrop-filter: blur(18px);
}

.stat-card {
    padding: 18px;
    min-height: 154px;
    position: relative;
    overflow: hidden;
}

    .stat-card::after {
        content: "";
        position: absolute;
        inset-inline-end: -42px;
        inset-block-start: -42px;
        width: 130px;
        height: 130px;
        border-radius: 999px;
        background: var(--primary-soft);
        filter: blur(2px);
    }

.stat-card-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 23px;
    flex: 0 0 auto;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-family: "IRANSans";
    margin: 0 0 8px;
}

.stat-value {
    font-size: 26px;
    font-family: var(--font-main-bold);
    letter-spacing: -.6px;
    margin: 0;
}

.stat-foot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 12px;
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    border-radius: 999px;
    padding-inline: 8px;
    font-size: 11px;
    font-family: var(--font-main-bold);
}

    .trend.good {
        color: var(--success);
        background: var(--success-soft);
    }

    .trend.warn {
        color: var(--warning);
        background: var(--warning-soft);
    }

    .trend.bad {
        color: var(--danger);
        background: var(--danger-soft);
    }

.section-card {
    padding: 20px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-title h2 {
    font-size: 16px;
    font-family: var(--font-main-bolder);
    margin: 0;
    letter-spacing: -.25px;
}

.section-title p {
    color: var(--muted);
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.7;
}

.soft-btn {
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--text);
    border-radius: 13px;
    min-height: 38px;
    padding-inline: 12px;
    font-size: 12px;
    font-family: var(--font-main-bold);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: background var(--ui-transition, 220ms ease), transform var(--ui-transition, 220ms ease), border-color var(--ui-transition, 220ms ease);
}

    .soft-btn:hover {
        transform: translateY(-1px);
        border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
        background: var(--surface-alt);
    }

.asset-map {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.asset-card {
    border: 1px solid var(--border);
    background: var(--surface-solid);
    border-radius: 18px;
    padding: 14px;
    position: relative;
    overflow: hidden;
}

    .asset-card::before {
        content: "";
        position: absolute;
        inset-inline-start: 0;
        inset-block: 0;
        width: 4px;
        background: var(--ui-accent-color, var(--primary));
    }

    .asset-card small {
        color: var(--muted);
        font-size: 11px;
    }

    .asset-card h3 {
        font-size: 14px;
        margin: 7px 0 12px;
        font-family: var(--font-main-bolder);
    }

.health-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.health-score {
    font-size: 22px;
    font-family: var(--font-main-bolder);
    color: var(--ui-accent-color, var(--primary));
}

.health-status {
    font-size: 11px;
    font-family: var(--font-main-bolder);
    border-radius: 999px;
    padding: 5px 8px;
    color: var(--ui-accent-color, var(--primary));
    background: color-mix(in srgb, var(--ui-accent-color, var(--primary)) 14%, transparent);
}

.progress.slim {
    height: 7px;
    border-radius: 999px;
    background: var(--surface-alt);
    overflow: hidden;
}

    .progress.slim .progress-bar {
        border-radius: 999px;
        background: var(--ui-accent-color, var(--primary));
    }

.risk-layout {
    display: grid;
    grid-template-columns: 1.35fr .65fr;
    gap: 18px;
    align-items: stretch;
}

.diagnosis-panel {
    border-radius: 22px;
    padding: 18px;
    background: linear-gradient(135deg, rgba(37, 99, 235, .14), rgba(20, 184, 166, .08)), var(--surface-solid);
    border: 1px solid var(--border);
    min-height: 100%;
    position: relative;
    overflow: hidden;
}

    .diagnosis-panel::after {
        content: "";
        position: absolute;
        width: 240px;
        height: 240px;
        border-radius: 50%;
        inset-inline-end: -100px;
        inset-block-end: -120px;
        background: rgba(96, 165, 250, .16);
    }

.ai-mark {
    width: 54px;
    height: 54px;
    border-radius: 19px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 29px;
    box-shadow: 0 20px 45px rgba(37, 99, 235, .25);
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.diagnosis-panel h3,
.diagnosis-panel p,
.diagnosis-actions {
    position: relative;
    z-index: 1;
}

.diagnosis-panel h3 {
    font-size: 17px;
    font-family: var(--font-main-bolder);
    margin-bottom: 8px;
}

.diagnosis-panel p {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.9;
    margin-bottom: 18px;
}

.primary-btn {
    border: 0;
    min-height: 40px;
    border-radius: 14px;
    padding-inline: 14px;
    color: #fff;
    font-size: 12px;
    font-family: var(--font-main-bolder);
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 14px 30px rgba(37, 99, 235, .22);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: start;
}

html[dir="rtl"] .timeline-item {
    grid-template-columns: 1fr 32px;
}

html[dir="rtl"] .timeline-dot {
    order: 2;
}

html[dir="rtl"] .timeline-body {
    order: 1;
}

.timeline-dot {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 17px;
}

    .timeline-dot.danger {
        background: var(--danger-soft);
        color: var(--danger);
    }

    .timeline-dot.info {
        background: var(--info-soft);
        color: var(--info);
    }

.timeline-body {
    border-bottom: 1px dashed var(--border);
    padding-bottom: 12px;
}

.timeline-item:last-child .timeline-body {
    border-bottom: 0;
    padding-bottom: 0;
}

.timeline-body strong {
    display: block;
    font-size: 12.5px;
    margin-bottom: 5px;
}

.timeline-body p {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.7;
    margin: 0;
}

.timeline-body time {
    color: var(--muted-2);
    font-size: 10.5px;
    display: block;
    margin-top: 6px;
}

.quality-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quality-metric {
    border-radius: 17px;
    border: 1px solid var(--border);
    background: var(--surface-solid);
    padding: 14px;
}

    .quality-metric .meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 8px;
    }

    .quality-metric small {
        color: var(--muted);
        font-size: 11px;
    }

    .quality-metric strong {
        font-size: 20px;
        font-family: var(--font-main-bold);
    }

.sparkline {
    width: 100%;
    height: 46px;
    margin-top: 6px;
}

    .sparkline path {
        fill: none;
        stroke: var(--chart-line);
        stroke-width: 3;
        stroke-linecap: round;
    }

    .sparkline .fill {
        fill: color-mix(in srgb, var(--primary) 10%, transparent);
        stroke: none;
    }

.test-bars {
    display: grid;
    gap: 13px;
}

.bar-row {
    display: grid;
    gap: 7px;
}

.bar-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

    .bar-meta strong {
        color: var(--text);
        font-size: 12.5px;
    }

.data-table-wrap {
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: var(--surface-solid);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    min-width: 760px;
}

    .modern-table th,
    .modern-table td {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
        font-size: 12.5px;
        white-space: nowrap;
    }

    .modern-table th {
        color: var(--muted);
        background: var(--surface-alt);
        font-family: var(--font-main-bolder);
    }

    .modern-table tr:last-child td {
        border-bottom: 0;
    }

.table-action-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.asset-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asset-symbol {
    width: 34px;
    height: 34px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 18px;
}

.asset-name strong {
    display: block;
    font-size: 12.5px;
}

.asset-name span {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    margin-top: 3px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 11px;
    font-family: var(--font-main-bolder);
}

    .pill.good {
        color: var(--success);
        background: var(--success-soft);
    }

    .pill.warn {
        color: var(--warning);
        background: var(--warning-soft);
    }

    .pill.bad {
        color: var(--danger);
        background: var(--danger-soft);
    }

    .pill.info {
        color: var(--info);
        background: var(--info-soft);
    }

.notes-list {
    display: grid;
    gap: 10px;
}

.note-card {
    border: 1px solid var(--border);
    background: var(--surface-solid);
    border-radius: 17px;
    padding: 13px;
}

.note-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

    .note-head strong {
        font-size: 12.5px;
    }

    .note-head time {
        color: var(--muted-2);
        font-size: 10.5px;
    }

.note-card p {
    margin: 0;
    color: var(--muted);
    font-size: 11.7px;
    line-height: 1.8;
}

.forum-item {
    display: flex;
    gap: 11px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}

    .forum-item:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

.forum-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 19px;
}

.forum-item strong {
    display: block;
    font-size: 12.5px;
    margin-bottom: 5px;
}

.forum-item p {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.65;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quick-action {
    border: 1px solid var(--border);
    background: var(--surface-solid);
    color: var(--text);
    border-radius: 17px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 72px;
    transition: transform var(--ui-transition, 220ms ease), border-color var(--ui-transition, 220ms ease), background var(--ui-transition, 220ms ease);
}

    .quick-action:hover {
        transform: translateY(-2px);
        border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
        background: var(--surface-alt);
    }

    .quick-action i {
        width: 38px;
        height: 38px;
        border-radius: 14px;
        display: grid;
        place-items: center;
        color: var(--primary);
        background: var(--primary-soft);
        font-size: 20px;
        flex: 0 0 auto;
    }

    .quick-action strong {
        display: block;
        font-size: 12.5px;
        margin-bottom: 3px;
    }

    .quick-action span {
        display: block;
        color: var(--muted);
        font-size: 10.5px;
        line-height: 1.5;
    }

/* Collapsed sidebar */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main-area {
    margin-inline-start: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .side-link span,
body.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .company-logo {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-inline: 12px;
}

body.sidebar-collapsed .side-link {
    justify-content: center;
    padding-inline: 10px;
}

    body.sidebar-collapsed .side-link.active::before {
        display: none;
    }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .5);
    z-index: 1030;
}

/* Responsive */
@media (max-width: 1200px) {
    .asset-map {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .risk-layout {
        grid-template-columns: 1fr;
    }

    .search-pill {
        display: none;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-110%);
    }

    html[dir="rtl"] .sidebar {
        transform: translateX(110%);
    }

    html[dir="ltr"] .sidebar {
        transform: translateX(-110%);
    }

    body.sidebar-mobile-open .sidebar {
        transform: translateX(0);
        width: var(--sidebar-width);
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }

    .main-area,
    body.sidebar-collapsed .main-area {
        margin-inline-start: 0;
    }

    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
    }

    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .side-link span,
    body.sidebar-collapsed .nav-section-title,
    body.sidebar-collapsed .company-logo {
        opacity: 1;
        pointer-events: auto;
        width: auto;
    }

    body.sidebar-collapsed .side-link {
        justify-content: flex-start;
    }

    html[dir="rtl"] body.sidebar-collapsed .side-link {
        justify-content: flex-start;
    }

    .profile-mini {
        display: none;
    }

    .profile-btn {
        padding-inline: 6px;
    }
}

@media (max-width: 768px) {
    .topbar {
        align-items: flex-start;
    }

    .topbar-inner {
        flex-wrap: wrap;
    }

    .header-title {
        order: 3;
        flex-basis: 100%;
    }

        .header-title p {
            max-width: 100%;
        }

    .topbar-actions {
        margin-inline-start: auto;
    }

    .floating-menu {
        width: min(320px, calc(100vw - 28px));
    }

    .asset-map,
    .quality-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .section-head {
        flex-direction: column;
    }
}

.sticky-top-module {
    position: sticky;
    top: calc(var(--header-height) + 10px);
}

/* Buttons */
.kebab-btn {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid var(--border, rgba(124, 139, 161, .22));
    background: var(--surface-alt, #eef3f8);
    color: var(--muted, #6e7b8f);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--ui-transition, 220ms ease);
}

    .kebab-btn i {
        font-size: 1.25rem;
    }

    .kebab-btn:hover,
    .kebab-btn:focus-visible {
        color: var(--primary, #2563eb);
        background: var(--primary-soft, rgba(37, 99, 235, .11));
    }


/* Chart */
.chart-controls {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

    .chart-controls > div {
        display: flex;
        align-items: center;
        gap: 5px;
    }

.chart-extra-control .apexcharts-toolbar,
.chart-no-control .apexcharts-toolbar {
    display: none !important;
}

#modal_chart_view{
    display: flex;
    flex-direction: column;
}

#modal_chart_view > div {
    width: 100%;
    min-height: 0;
    flex-grow: 1;
}

.apexcharts-grid-row:nth-child(2n+1) {
    fill: var(--chart-grid-stripe);
}
.apexcharts-grid-row:nth-child(2n) {
    fill: transparent;
}
.apexcharts-gridline {
    stroke: var(--chart-gridline);
    stroke-dasharray: 0px;
    stroke-linecap: butt;
}
.apexcharts-text {
    fill: var(--text);
}

.apexcharts-tooltip:has(.ui-chart-tooltip) {
    background: unset !important;
    border: unset !important;
}
.ui-chart-tooltip {
    min-width: 150px;
    background: var(--chart-tooltip-bg);
    color: var(--chart-tooltip-text);
    border: 1px solid var(--chart-tooltip-border);
    border-radius: var(--ui-radius-sm);
    box-shadow: var(--chart-tooltip-shadow);
    font-family: var(--font-main);
    overflow: hidden;
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
}

.ui-chart-tooltip-title {
    padding: .55rem .75rem;
    background: var(--chart-tooltip-title-bg);
    color: var(--chart-tooltip-muted);
    border-bottom: 1px solid var(--chart-tooltip-border);
    font-family: var(--font-main-bold);
    font-size: var(--ui-fs-xs);
    font-weight: 700;
}

.ui-chart-tooltip-body {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .65rem .75rem;
}

.ui-chart-tooltip-marker {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 999px;
    animation: tooltip-flash 2s ease-out infinite;
}
@keyframes tooltip-flash {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.ui-chart-tooltip-content {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.ui-chart-tooltip-label {
    color: var(--chart-tooltip-muted);
    font-family: var(--font-main);
    font-size: var(--ui-fs-xs);
}

.ui-chart-tooltip-value {
    color: var(--chart-tooltip-value);
    font-family: var(--font-main-bold);
    font-size: var(--ui-fs-sm);
    font-weight: 800;
}

html[dir="rtl"] .ui-chart-tooltip {
    direction: rtl;
    text-align: right;
}

/* --------- Icon ----------- */
.icon-slash {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .icon-slash::after {
        content: "";
        position: absolute;
        width: 120%;
        height: 2px;
        background: currentColor;
        border-radius: 999px;
        transform: rotate(-45deg);
        transform-origin: center;
        pointer-events: none;
    }