/* ===========================
           CSS VARIABLES
        =========================== */
:root {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --cyan: #06b6d4;
    --cyan-light: #22d3ee;
    --purple: #8b5cf6;
    --purple-light: #a78bfa;
    --emerald: #10b981;
    --emerald-light: #34d399;
    --rose: #f43f5e;
    --rose-light: #fb7185;
    --amber: #f59e0b;
    --amber-light: #fbbf24;
    --font-jakarta: 'Plus Jakarta Sans', sans-serif;
    --sidebar-width: 272px;
    --sidebar-collapsed: 80px;
    --navbar-height: 68px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --safe-left: env(safe-area-inset-left, 0);
    --safe-right: env(safe-area-inset-right, 0);
}

[data-theme="dark"] {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-card-hover: rgba(31, 41, 55, 0.85);
    --bg-card-solid: #111827;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(148, 163, 184, 0.08);
    --border-hover: rgba(148, 163, 184, 0.2);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #3b82f6, #06b6d4);
    --gradient-secondary: linear-gradient(135deg, #8b5cf6, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-danger: linear-gradient(135deg, #f43f5e, #f59e0b);
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-hover: rgba(241, 245, 249, 0.92);
    --bg-card-solid: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(148, 163, 184, 0.18);
    --border-hover: rgba(148, 163, 184, 0.35);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
    --gradient-primary: linear-gradient(135deg, #3b82f6, #06b6d4);
    --gradient-secondary: linear-gradient(135deg, #8b5cf6, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-danger: linear-gradient(135deg, #f43f5e, #f59e0b);
}

/* ===========================
           RESET & BASE
        =========================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-jakarta);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

::selection {
    background: rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

a {
    text-decoration: none;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

input,
select,
textarea {
    font-family: inherit;
}

/* ===========================
           LAYOUT
        =========================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
    transition: margin-left var(--transition-normal);
    min-width: 0;
    width: 100%;
}

.main-content.collapsed {
    margin-left: var(--sidebar-collapsed);
}

.page-content {
    padding: 24px;
    padding-top: calc(var(--navbar-height) + 24px);
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 100%;
    overflow-x: hidden;
}

/* ===========================
           SIDEBAR
        =========================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card-solid);
    border-right: 1px solid var(--border-color);
    z-index: 50;
    transition: width var(--transition-normal), transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    height: var(--navbar-height);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.sidebar-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    animation: shimmer 3s ease infinite;
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition-normal), width var(--transition-normal);
    min-width: 0;
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-normal);
}

.sidebar.collapsed .nav-section-title {
    opacity: 0;
    height: 0;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    margin-bottom: 2px;
    width: 100%;
    text-align: left;
    min-height: 44px;
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.35);
}

.nav-link i,
.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-link .nav-text {
    overflow: hidden;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

.sidebar.collapsed .nav-link .nav-text,
.sidebar.collapsed .nav-link .nav-badge,
.sidebar.collapsed .nav-link .nav-arrow {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    color: #fff;
    flex-shrink: 0;
}

.nav-badge.red {
    background: var(--rose);
}

.nav-badge.green {
    background: var(--emerald);
}

.nav-badge.blue {
    background: var(--primary);
}

.nav-badge.purple {
    background: var(--purple);
}

.nav-arrow {
    margin-left: auto;
    width: 16px !important;
    height: 16px !important;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.nav-link.expanded .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
    padding-left: 8px;
}

.nav-submenu.open {
    max-height: 300px;
}

.nav-submenu .nav-link {
    padding: 8px 12px 8px 36px;
    font-size: 13px;
    min-height: 40px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    background: var(--bg-card-hover);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
}

.sidebar-user:hover {
    background: var(--gradient-primary);
}

.sidebar-user:hover .u-name,
.sidebar-user:hover .u-role {
    color: #fff;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user-info {
    overflow: hidden;
    transition: opacity var(--transition-normal);
    min-width: 0;
}

.sidebar.collapsed .sidebar-user-info {
    opacity: 0;
    width: 0;
}

.u-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    transition: color 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
}

.u-role {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color 0.2s;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ===========================
           NAVBAR
        =========================== */
.navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--navbar-height);
    background: var(--bg-card-solid);
    border-bottom: 1px solid var(--border-color);
    z-index: 40;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    transition: left var(--transition-normal);
}

.navbar.collapsed {
    left: var(--sidebar-collapsed);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-icon-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
    flex-shrink: 0;
}

.nav-icon-btn:hover,
.nav-icon-btn:active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.nav-icon-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rose);
    border: 2px solid var(--bg-card-solid);
}

.mobile-toggle {
    display: none;
}

.navbar-search {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.navbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card-hover);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-jakarta);
    outline: none;
    transition: all var(--transition-fast);
}

.navbar-search input::placeholder {
    color: var(--text-muted);
}

.navbar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.navbar-search .s-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.navbar-search .s-key {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-card-solid);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    pointer-events: none;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover,
.theme-toggle:active {
    background: var(--bg-card-hover);
    color: var(--amber);
    border-color: var(--border-hover);
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: block;
}

.live-ticker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 10px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--emerald);
    position: relative;
    flex-shrink: 0;
}

.live-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--emerald);
    opacity: 0.4;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0;
        transform: scale(1.8);
    }
}

.navbar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.navbar-profile:hover,
.navbar-profile:active {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.navbar-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}

.navbar-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.np-info-text {
    text-align: left;
    min-width: 0;
}

.np-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.np-role {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===========================
           DROPDOWN
        =========================== */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all var(--transition-normal);
    z-index: 200;
    overflow: hidden;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dd-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dd-body {
    padding: 8px;
    max-height: 340px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.dd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 44px;
}

.dd-item:hover,
.dd-item:active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dd-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.dd-footer a {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.notif-item:hover,
.notif-item:active {
    background: var(--bg-card-hover);
}

.notif-item.unread {
    background: rgba(59, 130, 246, 0.04);
}

.notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.notif-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.notif-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===========================
           CARD
        =========================== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all var(--transition-normal);
    min-width: 0;
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card);
}

.card-pad {
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header>div:first-child {
    min-width: 0;
    flex: 1;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===========================
           STAT CARDS
        =========================== */
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    opacity: 1 !important;
    visibility: visible !important;
    min-width: 0;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 16px 16px 0 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-card);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card.c-blue::before {
    background: var(--gradient-primary);
}

.stat-card.c-green::before {
    background: var(--gradient-success);
}

.stat-card.c-amber::before {
    background: linear-gradient(135deg, var(--amber), var(--amber-light));
}

.stat-card.c-purple::before {
    background: var(--gradient-secondary);
}

.sc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sc-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sc-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
    word-break: break-word;
}

.sc-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 12px;
}

.sc-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    flex-wrap: wrap;
}

.sc-trend.up {
    color: var(--emerald);
}

.sc-trend.down {
    color: var(--rose);
}

.icon-btn-ghost {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.icon-btn-ghost:hover,
.icon-btn-ghost:active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ===========================
           CHART TABS
        =========================== */
.chart-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card-hover);
    padding: 4px;
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
}

.chart-tabs::-webkit-scrollbar {
    display: none;
}

.chart-tab {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    font-family: var(--font-jakarta);
    white-space: nowrap;
    flex-shrink: 0;
}

.chart-tab:hover {
    color: var(--text-primary);
}

.chart-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* ===========================
           BUTTONS
        =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-jakarta);
    transition: all var(--transition-fast);
    outline: none;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    min-height: 44px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-gradient {
    background: var(--gradient-secondary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
}

.btn-danger {
    background: var(--gradient-danger);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 32px;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ===========================
           BADGE
        =========================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-light);
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: var(--rose-light);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--amber-light);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--purple-light);
}

/* ===========================
           PROGRESS
        =========================== */
.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-card-hover);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    position: relative;
    transition: width 1.2s ease;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    animation: shimmer 2s linear infinite;
    background-size: 200% 100%;
}

/* ===========================
           PORTFOLIO BANNER
        =========================== */
.portfolio-banner {
    background: var(--gradient-primary);
    border-radius: 20px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    color: #fff;
}

.portfolio-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.portfolio-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 40%;
    height: 160%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.banner-content {
    position: relative;
    z-index: 1;
}

.banner-img {
    position: absolute;
    right: 24px;
    bottom: -8px;
    width: 240px;
    height: auto;
    opacity: 0.2;
    pointer-events: none;
}

.banner-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.2;
}

.banner-desc {
    font-size: 14px;
    opacity: 0.85;
    max-width: 500px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.banner-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===========================
           WATCHLIST
        =========================== */
.wl-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 56px;
}

.wl-item:hover,
.wl-item:active {
    background: var(--bg-card-hover);
}

.wl-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
}

.wl-icon img {
    width: 24px;
    height: 24px;
}

.wl-info {
    flex: 1;
    min-width: 0;
}

.wl-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wl-sym {
    font-size: 12px;
    color: var(--text-muted);
}

.wl-price {
    text-align: right;
    flex-shrink: 0;
}

.wl-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.wl-chg {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.price-up {
    color: var(--emerald);
}

.price-down {
    color: var(--rose);
}

/* ===========================
           ACTIVITY
        =========================== */
.act-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    min-height: 66px;
}

.act-item:last-child {
    border-bottom: none;
}

.act-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.act-content {
    flex: 1;
    min-width: 0;
}

.act-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.act-desc {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.act-right {
    text-align: right;
    flex-shrink: 0;
}

.act-val {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.act-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
}

/* ===========================
           BOT CARD
        =========================== */
.bot-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.bot-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.bot-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card-hover);
    flex-shrink: 0;
}

.bot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--emerald);
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.bot-pulse::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--emerald);
    opacity: 0.4;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.bot-stat {
    padding: 12px;
    border-radius: 10px;
    background: var(--bg-card-hover);
    min-width: 0;
}

.bot-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.bot-stat-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    word-break: break-word;
}

/* ===========================
           TABLE
        =========================== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    min-width: 800px;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.crypto-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.crypto-cell-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-card-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}

.crypto-cell-icon img {
    width: 24px;
    height: 24px;
}

.c-name {
    font-weight: 600;
    color: var(--text-primary);
}

.c-sym {
    font-size: 12px;
    color: var(--text-muted);
}

.mini-chart {
    width: 100px;
    height: 32px;
}

/* Scroll Hint */
.scroll-hint {
    display: none;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    align-items: center;
    gap: 4px;
}

/* ===========================
           SIGNAL CARD
        =========================== */
.signal-card {
    padding: 14px;
    border-radius: 12px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
}

.signal-card.long {
    border-left: 3px solid var(--emerald);
}

.signal-card.short {
    border-left: 3px solid var(--rose);
}

.signal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 6px;
}

.signal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* ===========================
           MODAL
        =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    margin: auto;
}

.modal-overlay.show .modal-box {
    transform: scale(1) translateY(0);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-head h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.modal-close-btn:hover,
.modal-close-btn:active {
    background: rgba(244, 63, 94, 0.1);
    color: var(--rose);
    border-color: var(--rose);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* ===========================
           FORMS
        =========================== */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card-hover);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-jakarta);
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select {
    appearance: none;
    cursor: pointer;
}

/* ===========================
           TOAST
        =========================== */
.toast-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}

.toast {
    min-width: 320px;
    max-width: 420px;
    padding: 14px 20px;
    border-radius: 12px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    animation: toast-in 0.3s ease-out;
}

.toast.closing {
    animation: toast-out 0.3s ease-in forwards;
}

.toast.t-success {
    border-left: 3px solid var(--emerald);
}

.toast.t-error {
    border-left: 3px solid var(--rose);
}

.toast.t-warning {
    border-left: 3px solid var(--amber);
}

.toast.t-info {
    border-left: 3px solid var(--primary);
}

@keyframes toast-in {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.toast-msg {
    font-size: 13px;
    color: var(--text-muted);
    word-break: break-word;
}

.toast-close {
    width: 24px;
    height: 24px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.toast-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ===========================
           PAGE LOADER
        =========================== */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ===========================
           FOOTER
        =========================== */
.main-footer {
    padding: 20px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.main-footer a {
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.main-footer a:hover {
    color: var(--primary);
}

/* ===========================
           GRIDS
        =========================== */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ===================================================================
           RESPONSIVE BREAKPOINTS - PERFECT MOBILE FIRST
        =================================================================== */

/* Large Desktop (< 1400px) */
@media (max-width: 1400px) {
    .navbar-search {
        width: 260px;
    }
}

/* Desktop (< 1280px) */
@media (max-width: 1280px) {
    .navbar-search {
        width: 220px;
    }

    .live-ticker {
        display: none;
    }

    .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .grid-3>*:last-child {
        grid-column: 1 / -1;
    }
}

/* Small Desktop / Laptop (< 1100px) */
@media (max-width: 1100px) {
    .navbar-search {
        display: none;
    }

    .np-info-text {
        display: none;
    }

    .navbar-profile {
        padding: 5px;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2-1 {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-3>*:last-child {
        grid-column: auto;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Tablet (< 900px) */
@media (max-width: 900px) {
    :root {
        --navbar-height: 64px;
    }

    .page-content {
        padding: 20px;
        padding-top: calc(var(--navbar-height) + 20px);
        gap: 20px;
    }

    .portfolio-banner {
        padding: 28px;
    }

    .banner-img {
        width: 200px;
        opacity: 0.15;
    }

    .banner-title {
        font-size: 24px;
    }
}

/* Mobile Landscape / Small Tablet (< 768px) */
@media (max-width: 768px) {
    :root {
        --navbar-height: 60px;
    }

    /* Sidebar becomes off-canvas */
    .sidebar {
        transform: translateX(-100%);
        z-index: 60;
        width: 280px !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .navbar {
        left: 0 !important;
        padding: 0 12px;
        gap: 8px;
    }

    .mobile-toggle {
        display: flex;
    }

    .desktop-toggle {
        display: none;
    }

    .page-content {
        padding: 14px;
        padding-top: calc(var(--navbar-height) + 14px);
        gap: 16px;
    }

    /* Grids stack */
    .grid-4 {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Stat cards */
    .stat-card {
        padding: 16px;
    }

    .sc-value {
        font-size: 20px;
    }

    .sc-label {
        font-size: 12px;
        margin-bottom: 10px;
    }

    .sc-trend {
        font-size: 12px;
    }

    .sc-trend>span:last-child {
        display: none;
    }

    .sc-icon {
        width: 40px;
        height: 40px;
    }

    .sc-icon i {
        width: 18px !important;
        height: 18px !important;
    }

    .sc-header {
        margin-bottom: 12px;
    }

    /* Card padding */
    .card-pad {
        padding: 16px;
    }

    .card-header {
        margin-bottom: 16px;
        gap: 8px;
    }

    .card-title {
        font-size: 15px;
    }

    .card-subtitle {
        font-size: 12px;
    }

    /* Banner */
    .portfolio-banner {
        padding: 20px;
        border-radius: 16px;
    }

    .banner-title {
        font-size: 22px;
    }

    .banner-desc {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .banner-img {
        width: 140px;
        opacity: 0.12;
        right: 12px;
    }

    .banner-buttons .btn {
        flex: 1;
        min-width: 130px;
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Signal grid */
    .signal-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .signal-card {
        padding: 12px;
    }

    /* Bot grid stays 2x2 */
    .bot-card {
        padding: 16px;
    }

    .bot-stat {
        padding: 10px;
    }

    .bot-stat-val {
        font-size: 16px;
    }

    .bot-avatar {
        width: 48px;
        height: 48px;
    }

    /* Toast */
    .toast-container {
        top: calc(12px + var(--safe-top));
        right: 12px;
        left: 12px;
        max-width: calc(100vw - 24px);
    }

    .toast {
        min-width: auto;
        max-width: 100%;
        padding: 12px 14px;
    }

    .toast-title {
        font-size: 13px;
    }

    .toast-msg {
        font-size: 12px;
    }

    /* Modal */
    .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .modal-box {
        border-radius: 18px;
        max-height: 88vh;
        max-height: 88dvh;
    }

    .modal-head {
        padding: 16px 18px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-foot {
        padding: 14px 18px;
    }

    .modal-foot .btn {
        flex: 1;
    }

    /* Dropdown */
    .dropdown-menu {
        position: fixed;
        top: calc(var(--navbar-height) + 8px) !important;
        right: 12px !important;
        left: 12px !important;
        min-width: auto !important;
        max-width: none !important;
    }

    /* Show scroll hint on tables */
    .scroll-hint {
        display: flex;
    }

    /* Portfolio profile info hidden already */
    .navbar-profile {
        border: none;
        padding: 3px;
    }

    /* Chart tabs scrollable */
    .chart-tabs {
        max-width: 100%;
    }

    /* Footer */
    .main-footer {
        padding: 16px 0;
    }

    .main-footer>* {
        text-align: center;
        width: 100%;
    }

    .main-footer>div:last-child {
        justify-content: center;
    }

    /* Adjust nav-icon-btn spacing */
    .navbar-right {
        gap: 4px;
    }

    .nav-icon-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .theme-toggle {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    /* Hide messages icon on smaller mobile to save space */
    .hide-mobile {
        display: none !important;
    }
}

/* Small Mobile (< 640px) */
@media (max-width: 640px) {
    .page-content {
        padding: 12px;
        padding-top: calc(var(--navbar-height) + 12px);
        gap: 14px;
    }

    .grid-4 {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .sc-value {
        font-size: 18px;
    }

    .sc-header {
        margin-bottom: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .banner-title {
        font-size: 20px;
    }

    .banner-desc {
        font-size: 12.5px;
    }

    .banner-img {
        display: none;
    }

    .banner-buttons {
        gap: 8px;
    }

    .banner-buttons .btn {
        min-width: 0;
        width: 100%;
    }

    .card-title {
        font-size: 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header>*:last-child {
        align-self: stretch;
    }

    /* Trading Performance Chart Legend */
    .card-header>div[style*="display:flex;gap:16px"] {
        flex-wrap: wrap;
    }

    /* Chart tabs */
    .chart-tab {
        padding: 5px 10px;
        font-size: 11px;
    }

    /* Watchlist */
    .wl-item {
        padding: 8px 10px;
    }

    .wl-icon {
        width: 32px;
        height: 32px;
    }

    .wl-icon img {
        width: 20px;
        height: 20px;
    }

    .wl-name,
    .wl-val {
        font-size: 13px;
    }

    .wl-sym,
    .wl-chg {
        font-size: 11px;
    }

    /* Activity items */
    .act-item {
        gap: 10px;
        padding: 10px 0;
    }

    .act-icon {
        width: 36px;
        height: 36px;
    }

    .act-title {
        font-size: 13px;
    }

    .act-desc {
        font-size: 11px;
    }

    .act-val {
        font-size: 13px;
    }

    /* Bot card grid becomes 2x2 still */
    .bot-stat-val {
        font-size: 15px;
    }

    /* AI Prediction cards */
    .card-pad>div>div[style*="padding:14px"] {
        padding: 12px !important;
    }

    /* Buttons */
    .btn {
        padding: 9px 16px;
        font-size: 13px;
        min-height: 40px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
        min-height: 28px;
    }

    /* Bot buttons */
    .bot-card .btn {
        margin-top: 12px !important;
    }

    /* Notif */
    .notif-item {
        padding: 10px;
    }
}

/* Extra Small Mobile (< 480px) */
@media (max-width: 480px) {
    :root {
        --navbar-height: 56px;
    }

    .page-content {
        padding: 10px;
        padding-top: calc(var(--navbar-height) + 10px);
        gap: 12px;
    }

    /* Stat cards single column */
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .sc-value {
        font-size: 24px;
    }

    .sc-label {
        font-size: 12px;
    }

    .sc-trend {
        font-size: 12px;
    }

    .sc-trend>span:last-child {
        display: inline;
    }

    /* Banner */
    .portfolio-banner {
        padding: 18px;
        border-radius: 14px;
    }

    .banner-title {
        font-size: 18px;
    }

    .banner-desc {
        font-size: 12px;
        margin-bottom: 14px;
    }

    /* Card */
    .card {
        border-radius: 14px;
    }

    .card-pad {
        padding: 14px;
    }

    /* Sidebar mobile */
    .sidebar {
        width: 260px !important;
    }

    /* Navbar */
    .navbar {
        padding: 0 10px;
        gap: 6px;
    }

    .nav-icon-btn,
    .theme-toggle {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 9px;
    }

    .nav-icon-btn i,
    .theme-toggle i {
        width: 18px !important;
        height: 18px !important;
    }

    .navbar-profile-avatar {
        width: 32px;
        height: 32px;
    }

    /* Signal cards padding */
    .signal-card {
        padding: 10px;
    }

    /* Modal */
    .modal-overlay {
        padding: 8px;
    }

    .modal-box {
        border-radius: 16px;
    }

    .modal-head h3 {
        font-size: 16px;
    }

    .modal-close-btn {
        width: 32px;
        height: 32px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-foot {
        padding: 12px 16px;
        gap: 8px;
    }

    .modal-foot .btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Dropdown */
    .dropdown-menu {
        top: calc(var(--navbar-height) + 6px) !important;
        right: 10px !important;
        left: 10px !important;
    }

    .dd-header {
        padding: 12px;
    }

    .dd-body {
        padding: 6px;
        max-height: calc(70vh - 100px);
    }

    .dd-item {
        padding: 8px 10px;
        min-height: 40px;
        font-size: 13px;
    }

    /* Table remains scrollable */
    .data-table {
        min-width: 700px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .mini-chart {
        width: 80px !important;
    }

    /* Bot stats keep 2 columns */
    .bot-stat {
        padding: 10px;
    }

    .bot-stat-label {
        font-size: 10px;
    }

    .bot-stat-val {
        font-size: 15px;
    }
}

/* Very Small / Fold (< 380px) */
@media (max-width: 380px) {
    .page-content {
        padding: 8px;
        padding-top: calc(var(--navbar-height) + 8px);
    }

    .navbar {
        padding: 0 8px;
        gap: 4px;
    }

    .navbar-right {
        gap: 3px;
    }

    .nav-icon-btn,
    .theme-toggle {
        width: 34px;
        height: 34px;
        min-width: 34px;
    }

    .navbar-profile {
        padding: 2px;
    }

    .navbar-profile-avatar {
        width: 30px;
        height: 30px;
        border-radius: 7px;
    }

    .sidebar {
        width: 240px !important;
    }

    .sidebar-header {
        padding: 12px 16px;
    }

    .sidebar-nav {
        padding: 12px 10px;
    }

    .portfolio-banner {
        padding: 16px;
    }

    .banner-title {
        font-size: 17px;
    }

    .banner-desc {
        font-size: 11.5px;
    }

    .banner-buttons .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

    .stat-card {
        padding: 14px;
    }

    .sc-icon {
        width: 36px;
        height: 36px;
    }

    .sc-value {
        font-size: 20px;
    }

    .card-pad {
        padding: 12px;
    }

    .card-title {
        font-size: 14px;
    }

    .card-subtitle {
        font-size: 11px;
    }

    .wl-item {
        padding: 6px 8px;
        gap: 8px;
    }

    .wl-name,
    .wl-val {
        font-size: 12px;
    }

    .act-item {
        gap: 8px;
    }

    .act-icon {
        width: 32px;
        height: 32px;
    }

    .toast-container {
        top: calc(8px + var(--safe-top));
        right: 8px;
        left: 8px;
    }

    .modal-overlay {
        padding: 4px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar-footer {
        padding: 8px;
    }

    .sidebar-user {
        padding: 6px;
    }

    .sidebar-nav {
        padding: 8px 10px;
    }

    .nav-section {
        margin-bottom: 12px;
    }

    .nav-link {
        min-height: 36px;
        padding: 8px 12px;
    }

    .modal-box {
        max-height: 95vh;
        max-height: 95dvh;
    }

    .modal-head {
        padding: 12px 18px;
    }

    .modal-body {
        padding: 14px 18px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .nav-link:hover {
        transform: none;
        background: transparent;
        color: var(--text-secondary);
    }

    .nav-link:active {
        background: var(--bg-card-hover);
        color: var(--text-primary);
    }

    .nav-link.active {
        background: var(--gradient-primary);
        color: #fff;
    }

    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.97);
    }

    .stat-card:hover {
        transform: none;
    }

    .stat-card:active {
        transform: scale(0.98);
    }

    .card:hover {
        transform: none;
    }
}

/* Print */
@media print {

    .sidebar,
    .navbar,
    .sidebar-overlay,
    .toast-container,
    .page-loader {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Utility */
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.text-muted {
    color: var(--text-muted);
}

.flex-legend {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}