/* PolyBot - Professional Dark Trading Platform Theme */

/* ===========================
   GOOGLE FONTS
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===========================
   CSS CUSTOM PROPERTIES
   =========================== */
:root {
    /* Background layers */
    --bg-base: #0B0E14;
    --bg-surface: #111827;
    --bg-elevated: #1C2333;
    --bg-overlay: #232B3E;

    /* Sidebar */
    --sidebar-bg: #0F1420;
    --sidebar-bg-dark: #0B0E14;
    --sidebar-text: #8B8FA7;
    --sidebar-text-hover: #C5C8D9;
    --sidebar-active: #6366F1;
    --sidebar-active-bg: rgba(99, 102, 241, 0.10);
    --sidebar-width-expanded: 260px;
    --sidebar-width-collapsed: 68px;

    /* Content */
    --content-bg: #0B0E14;
    --content-bg-elevated: #111827;

    /* Cards */
    --card-bg: #1C2333;
    --card-border: rgba(255, 255, 255, 0.06);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);

    /* Text — high contrast for readability */
    --text-primary: #F0F1F7;
    --text-secondary: #B8BBCF;
    --text-muted: #8890A8;

    /* Accent colors */
    --accent-blue: #6366F1;
    --accent-blue-hover: #818CF8;
    --accent-blue-glow: rgba(99, 102, 241, 0.15);
    --accent-green: #10B981;
    --accent-green-bg: rgba(16, 185, 129, 0.10);
    --accent-red: #EF4444;
    --accent-red-bg: rgba(239, 68, 68, 0.10);
    --accent-yellow: #F59E0B;
    --accent-yellow-bg: rgba(245, 158, 11, 0.10);
    --accent-cyan: #22D3EE;
    --accent-cyan-bg: rgba(34, 211, 238, 0.10);

    /* Header */
    --header-height: 56px;
    --header-bg: rgba(15, 20, 32, 0.80);
    --header-border: rgba(255, 255, 255, 0.06);

    /* Input */
    --input-bg: #0F1420;
    --input-border: rgba(255, 255, 255, 0.10);
    --input-focus-border: var(--accent-blue);

    /* Login */
    --login-card-bg: #1C2333;
    --login-label: var(--text-secondary);

    /* Misc */
    --divider: rgba(255, 255, 255, 0.06);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition-fast: 200ms ease;
    --transition-normal: 300ms ease;
}

/* ===========================
   BASE & RESET
   =========================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin: 0; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; margin: 0; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; margin: 0; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.4; margin: 0; }

/* ===========================
   CUSTOM SCROLLBAR
   =========================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* ===========================
   LAYOUT - RADZEN OVERRIDES
   =========================== */

.rz-layout,
.polybot-layout {
    background-color: var(--bg-base) !important;
    min-height: 100vh;
    width: 100%;
}

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

.rz-header {
    background: var(--header-bg) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--header-border) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    height: var(--header-height) !important;
    min-height: var(--header-height) !important;
    max-height: var(--header-height) !important;
    z-index: 100;
    position: sticky !important;
    top: 0;
    transition: all var(--transition-normal);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.25rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-breadcrumb {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-toggle {
    color: var(--text-secondary) !important;
    border-radius: var(--radius-md) !important;
    width: 36px !important;
    height: 36px !important;
    transition: all var(--transition-fast) !important;
}

.sidebar-toggle:hover {
    color: var(--text-primary) !important;
    background-color: rgba(255, 255, 255, 0.06) !important;
}

/* Connection pill */
.connection-pill {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pill-connected {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.pill-connected .pill-dot {
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
}

.pill-disconnected {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    animation: pulse-glow 2s infinite;
}

.pill-disconnected .pill-dot {
    background: var(--accent-red);
    box-shadow: 0 0 6px var(--accent-red);
}

/* Keep legacy classes working */
.connection-indicator {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
}

.connection-indicator.connected {
    color: var(--accent-green);
    background: var(--accent-green-bg);
}

.connection-indicator.disconnected {
    color: var(--accent-red);
    background: var(--accent-red-bg);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* User area */
.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139, 92, 246, 0.5);
    flex-shrink: 0;
}

.plan-badge-header {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.plan-badge-header.pro {
    background: linear-gradient(135deg, #6C3AED, #8B5CF6);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 58, 237, 0.3);
}

.plan-badge-header.free {
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.plan-badge-header.free:hover {
    background: rgba(245, 158, 11, 0.25);
    transform: scale(1.05);
}

.upgrade-arrow {
    font-size: 0.8rem;
}

.header-username {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.logout-btn {
    color: var(--text-muted) !important;
    border-radius: var(--radius-md) !important;
    transition: all var(--transition-fast) !important;
}

.logout-btn:hover {
    color: var(--accent-red) !important;
    background: var(--accent-red-bg) !important;
}

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

.rz-sidebar,
.polybot-sidebar {
    background-color: var(--sidebar-bg) !important;
    border-right: 1px solid var(--card-border) !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 200;
}

/* Mobile: overlay shadow when open */
.is-mobile .rz-sidebar,
.is-mobile .polybot-sidebar {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5) !important;
    z-index: 1000 !important;
}

/* Sidebar brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--divider);
    min-height: var(--header-height);
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}

.brand-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-blue), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
    transition: opacity var(--transition-normal);
}

.sidebar-collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Sidebar nav wrapper */
.sidebar-nav-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid var(--divider);
    padding: 0.75rem 1rem;
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-footer-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: opacity var(--transition-normal);
}

.sidebar-collapsed .sidebar-version {
    opacity: 0;
}

/* Nav menu */
.rz-sidebar .rz-panel-menu,
.polybot-sidebar .rz-panel-menu,
.nav-menu {
    padding: 0.25rem 0.5rem !important;
    background: transparent !important;
}

.rz-sidebar .rz-navigation-item,
.polybot-sidebar .rz-navigation-item {
    border-radius: var(--radius-md) !important;
    margin-bottom: 2px;
    position: relative;
    transition: all var(--transition-fast) !important;
}

.rz-sidebar .rz-navigation-item-text,
.polybot-sidebar .rz-navigation-item-text {
    color: var(--sidebar-text) !important;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: opacity var(--transition-normal), color var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
}

/* Hide text when collapsed */
.sidebar-collapsed .rz-navigation-item-text {
    opacity: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Also hide the expand/collapse arrows when collapsed */
.sidebar-collapsed .rz-navigation-item-wrapper .rzi-chevron-down,
.sidebar-collapsed .rz-panel-menu-item-title-content,
.sidebar-collapsed .rz-navigation-item-wrapper > .rzi {
    opacity: 0 !important;
    width: 0 !important;
}

.rz-sidebar .rz-navigation-item-icon,
.rz-sidebar .rz-navigation-item-icon-wrapper,
.polybot-sidebar .rz-navigation-item-icon {
    color: var(--sidebar-text) !important;
    font-size: 1.25rem !important;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

/* Hover */
.rz-sidebar .rz-navigation-item:hover,
.polybot-sidebar .rz-navigation-item:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

.rz-sidebar .rz-navigation-item:hover .rz-navigation-item-text,
.rz-sidebar .rz-navigation-item:hover .rz-navigation-item-icon,
.rz-sidebar .rz-navigation-item:hover .rz-navigation-item-icon-wrapper,
.polybot-sidebar .rz-navigation-item:hover .rz-navigation-item-text,
.polybot-sidebar .rz-navigation-item:hover .rz-navigation-item-icon {
    color: var(--sidebar-text-hover) !important;
}

/* Active item — left accent bar */
.rz-sidebar .rz-navigation-item.rz-navigation-item-active,
.polybot-sidebar .rz-navigation-item.rz-navigation-item-active {
    background-color: var(--sidebar-active-bg) !important;
}

.rz-sidebar .rz-navigation-item.rz-navigation-item-active::before,
.polybot-sidebar .rz-navigation-item.rz-navigation-item-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--sidebar-active);
}

.rz-sidebar .rz-navigation-item.rz-navigation-item-active .rz-navigation-item-text,
.rz-sidebar .rz-navigation-item.rz-navigation-item-active .rz-navigation-item-icon,
.rz-sidebar .rz-navigation-item.rz-navigation-item-active .rz-navigation-item-icon-wrapper,
.polybot-sidebar .rz-navigation-item.rz-navigation-item-active .rz-navigation-item-text,
.polybot-sidebar .rz-navigation-item.rz-navigation-item-active .rz-navigation-item-icon {
    color: var(--sidebar-active) !important;
}

/* Submenu / panel titles */
.rz-sidebar .rz-panel-menu-item-title-content,
.polybot-sidebar .rz-panel-menu-item-title-content {
    color: var(--sidebar-text) !important;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 0 0.25rem 0.5rem;
    transition: opacity var(--transition-normal);
}

/* Submenu items indent */
.rz-sidebar .rz-panel-menu-item .rz-panel-menu-item .rz-navigation-item,
.polybot-sidebar .rz-panel-menu-item .rz-panel-menu-item .rz-navigation-item {
    padding-left: 0.5rem !important;
}

.sidebar-expanded .rz-panel-menu-item .rz-panel-menu-item .rz-navigation-item {
    padding-left: 1rem !important;
}

/* Force dark bg on all Radzen menu wrapper/children inside sidebar */
.rz-sidebar .rz-panel-menu-item,
.rz-sidebar .rz-panel-menu-item-content,
.rz-sidebar .rz-panel-menu-header,
.rz-sidebar .rz-panel-menu-header-text {
    background-color: transparent !important;
    color: var(--sidebar-text) !important;
}

.rz-sidebar .rz-panel-menu-item:hover,
.rz-sidebar .rz-panel-menu-header:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--sidebar-text-hover) !important;
}

/* Expand/collapse arrow color */
.rz-sidebar .rz-navigation-item-wrapper .rzi,
.rz-sidebar .rz-panel-menu .rzi {
    color: var(--sidebar-text) !important;
    transition: opacity var(--transition-normal);
}

/* Mobile sidebar overlay */
.sidebar-backdrop {
    display: none;
}

/* ===========================
   BODY / CONTENT AREA
   =========================== */

.rz-body {
    padding: 0 !important;
    background-color: var(--bg-base) !important;
    width: 100% !important;
    transition: margin-left var(--transition-normal);
}

.rz-body > div,
.rz-body > .main-content {
    width: 100% !important;
    max-width: 100% !important;
}

.main-content {
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 100%;
    min-height: calc(100vh - var(--header-height));
}

/* ===========================
   CARDS — let Radzen material-dark handle base colors
   =========================== */

.rz-card {
    border-radius: var(--radius-xl) !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* ===========================
   FORM INPUTS (DARK)
   =========================== */

/* Form inputs — Radzen material-dark handles colors */

/* Buttons — Radzen material-dark handles colors */

/* ===========================
   DATA GRID — minimal overrides (Radzen material-dark handles colors)
   =========================== */

.rz-datatable .rz-datatable-thead > tr > th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.rz-data-grid .rz-data-row td * {
    color: inherit;
}

/* Pager */
/* Pager — Radzen material-dark handles colors */

/* ===========================
   ALERT / NOTIFICATION
   =========================== */

/* Alert — Radzen material-dark handles colors */

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

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(34, 211, 238, 0.05) 0%, transparent 50%);
    padding: 1rem;
}

.login-card {
    background-color: var(--login-card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.35),
        0 0 80px rgba(99, 102, 241, 0.05);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    margin-bottom: 0.75rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.login-field {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--divider);
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.page-header {
    margin-bottom: 1.75rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

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

.wallet-status-card {
    padding: 1.5rem !important;
}

.wallet-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.wallet-status-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.wallet-status-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--divider);
    margin-top: 0.5rem;
}

.wallet-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wallet-detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.wallet-detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.wallet-config-card {
    padding: 1.5rem !important;
}

/* ===========================
   STATUS BADGES
   =========================== */

.badge-configured {
    display: inline-flex;
    align-items: center;
    background: var(--accent-green-bg);
    color: var(--accent-green);
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-top: 0.25rem;
}

.badge-not-configured {
    display: inline-flex;
    align-items: center;
    background: var(--accent-red-bg);
    color: var(--accent-red);
    padding: 0.2rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-top: 0.25rem;
}

.badge-active {
    display: inline-flex;
    align-items: center;
    background: var(--accent-green-bg);
    color: var(--accent-green);
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-paused {
    display: inline-flex;
    align-items: center;
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-stopped {
    display: inline-flex;
    align-items: center;
    background: var(--accent-red-bg);
    color: var(--accent-red);
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-created {
    display: inline-flex;
    align-items: center;
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===========================
   FORM UTILITIES
   =========================== */

.form-row {
    margin-bottom: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.375rem 0 0;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--divider);
}

/* ===========================
   STAT CARDS
   =========================== */

.stat-card {
    text-align: center;
    padding: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===========================
   MONOSPACE
   =========================== */

.monospace {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8125rem;
}

/* ===========================
   LOADING
   =========================== */

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
}

/* ===========================
   DIALOG OVERRIDES
   =========================== */

.rz-dialog {
    border-radius: var(--radius-xl) !important;
}

/* Dialog — Radzen material-dark handles colors */

/* ===========================
   NOTIFICATION OVERRIDES
   =========================== */

/* Notifications — Radzen material-dark handles colors */

/* ===========================
   UTILITY CLASSES
   =========================== */

.text-muted {
    color: var(--text-muted) !important;
}

.text-success {
    color: var(--accent-green) !important;
}

.text-danger {
    color: var(--accent-red) !important;
}

.text-warning {
    color: var(--accent-yellow) !important;
}

/* ===========================
   CONNECTION BANNER
   =========================== */

.connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
}

.connection-banner-alert {
    border-radius: 0 !important;
    margin: 0 !important;
    text-align: center;
    font-weight: 600;
}

/* ===========================
   METRIC CARDS
   =========================== */

.metric-card {
    --accent-color: var(--accent-blue);
    --accent-color-bg: var(--accent-blue-glow);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    min-width: 0;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card:hover {
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.30);
}

.metric-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-color-bg);
    color: var(--accent-color);
    flex-shrink: 0;
    font-size: 1.25rem;
}

.metric-icon .rzi {
    font-size: 1.25rem;
}

.metric-content {
    min-width: 0;
    flex: 1;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-title {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-delta {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.delta-positive {
    color: var(--accent-green);
}

.delta-negative {
    color: var(--accent-red);
}

.delta-arrow {
    margin-right: 0.15rem;
    font-size: 0.6rem;
    vertical-align: middle;
}

/* Accent colors are set via inline --accent-color and --accent-color-bg custom properties */

/* ===========================
   DASHBOARD LAYOUT
   =========================== */

.dashboard-market-selector {
    min-width: 320px;
    max-width: 420px;
}

.market-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    transition: border-color var(--transition-fast);
}

.market-selector:focus-within {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.market-selector .rz-dropdown {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.market-selector-dropdown {
    width: 100%;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-chart {
    min-height: 300px;
}

.dashboard-sidebar-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dashboard-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.card-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

/* Bot Status Grid */
.bot-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

/* ===========================
   PRICE CHART
   =========================== */

.price-chart-card {
    padding: 1.25rem !important;
    height: 100%;
}

.price-chart-header {
    margin-bottom: 0.75rem;
}

.price-chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.price-chart {
    height: 280px;
}

.price-chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 240px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.sidebar-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0;
}

/* ===========================
   SPREAD & ORDERBOOK
   =========================== */

.spread-card,
.orderbook-card {
    padding: 1rem !important;
}

.spread-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.spread-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spread-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.spread-value {
    font-size: 1rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.orderbook-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.orderbook-side {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.orderbook-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.orderbook-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.orderbook-price {
    font-weight: 500;
}

.orderbook-size {
    color: var(--text-muted);
}

/* ===========================
   ORDER GRID
   =========================== */

.side-buy {
    color: var(--accent-green);
    font-weight: 600;
}

.side-sell {
    color: var(--accent-red);
    font-weight: 600;
}

.side-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.side-badge-buy {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.side-badge-sell {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.order-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-order-pending {
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
}

.badge-order-open {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
}

.badge-order-filled {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.badge-order-cancelled {
    background: rgba(139, 140, 167, 0.12);
    color: var(--text-muted);
}

.badge-order-failed {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

/* ===========================
   ORDER HISTORY PAGE
   =========================== */

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.order-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.order-filters-card {
    margin-bottom: 1.5rem;
    padding: 1.25rem !important;
}

.order-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

/* ===========================
   BOT STATUS CARD
   =========================== */

.bot-status-card {
    padding: 1.25rem !important;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.bot-status-card:hover {
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.30);
}

.bot-border-active {
    border-left: 3px solid var(--accent-green);
}

.bot-border-paused {
    border-left: 3px solid var(--accent-yellow);
}

.bot-border-stopped {
    border-left: 3px solid var(--text-muted);
}

.bot-border-dead {
    border-left: 3px solid var(--accent-red);
}

.bot-paper-mode {
    background: repeating-linear-gradient(
        -45deg,
        var(--card-bg),
        var(--card-bg) 20px,
        rgba(99, 140, 255, 0.03) 20px,
        rgba(99, 140, 255, 0.03) 40px
    );
    border-style: dashed;
}

.bot-border-created {
    border-left: 3px solid var(--accent-blue);
}

.bot-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.bot-status-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.bot-status-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.bot-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.bot-position-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
}

.bot-market-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #FFFFFF;
    word-break: break-word;
}

.bot-status-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--divider);
}

.bot-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.bot-detail-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.bot-detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.circuit-breaker-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
}

.cb-closed {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.cb-open {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.cb-half-open {
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
}

/* ===========================
   MARKET CONFIG PAGE
   =========================== */

.market-config-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
    align-items: start;
}

.config-form-card {
    padding: 1.5rem !important;
}

.form-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.config-status-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bot-control-buttons {
    display: flex;
    gap: 0.75rem;
}

.bot-control-buttons .rz-button {
    flex: 1;
}

.w-100 {
    width: 100%;
}

/* ===========================
   TABS OVERRIDE
   =========================== */

.rz-tabview {
    background: transparent !important;
}

.rz-tabview-nav {
    border-bottom: 1px solid var(--divider) !important;
    background: transparent !important;
}

.rz-tabview-nav li .rz-tabview-nav-link {
    color: var(--text-muted) !important;
    transition: all var(--transition-fast);
}

.rz-tabview-nav li .rz-tabview-nav-link:hover {
    color: var(--text-primary) !important;
}

.rz-tabview-nav li.rz-tabview-selected .rz-tabview-nav-link {
    color: var(--accent-blue) !important;
    border-bottom-color: var(--accent-blue) !important;
}

.rz-tabview-panel {
    background: transparent !important;
    color: var(--text-primary) !important;
}

/* ===========================
   TOOLTIP OVERRIDE
   =========================== */

.rz-tooltip {
    background-color: var(--bg-overlay) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.75rem !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

/* ===========================
   RESPONSIVE — DESKTOP (>1024px)
   =========================== */

@media (min-width: 1025px) {
    .sidebar-backdrop {
        display: none !important;
    }

    /* Ensure body adapts to sidebar width */
    .sidebar-expanded .rz-body {
        margin-left: 0;
    }

    .sidebar-collapsed .rz-body {
        margin-left: 0;
    }
}

/* ===========================
   RESPONSIVE — TABLET (768-1024px)
   =========================== */

@media (max-width: 1024px) and (min-width: 769px) {
    .main-content {
        padding: 1.25rem 1.5rem;
    }
}

/* ===========================
   RESPONSIVE — DASHBOARD (< 1200px)
   =========================== */

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar-cards {
        flex-direction: row;
    }

    .dashboard-sidebar-cards > * {
        flex: 1;
    }

    .market-config-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================
   RESPONSIVE — MOBILE (<768px)
   =========================== */

@media (max-width: 768px) {
    /* Backdrop for mobile sidebar overlay */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .main-content {
        padding: 1rem;
    }

    .header-username {
        display: none;
    }

    .pill-text {
        display: none;
    }

    .connection-pill {
        padding: 0.25rem;
        min-width: 24px;
        justify-content: center;
    }

    .dashboard-metrics,
    .order-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-sidebar-cards {
        flex-direction: column;
    }

    .wallet-status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .wallet-status-details {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .rz-button {
        width: 100%;
    }

    .order-filters {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .page-header-row {
        flex-direction: column;
    }

    .bot-control-buttons {
        flex-direction: column;
    }

    .form-row-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard-metrics,
    .order-stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
    }

    .login-title {
        font-size: 1.5rem;
    }
}

/* ===========================
   SELECTION & FOCUS OUTLINES
   =========================== */

::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ===========================
   MARKET LIST PAGE
   =========================== */

.market-name-link {
    font-weight: 600;
    color: #FFFFFF !important;
    text-decoration: none;
    transition: color var(--transition-fast);
    font-size: 0.95rem;
}

.market-name-link:hover {
    color: var(--accent-blue) !important;
    text-decoration: underline;
}

.price-yes {
    font-weight: 600;
    color: var(--accent-green);
    font-variant-numeric: tabular-nums;
}

.price-no {
    font-weight: 600;
    color: var(--accent-red);
    font-variant-numeric: tabular-nums;
}

.tick-size-code {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.status-active {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.status-paused {
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
}

.status-resolved {
    background: rgba(107, 114, 128, 0.12);
    color: var(--text-muted);
}

.status-default {
    background: rgba(99, 102, 241, 0.10);
    color: var(--accent-blue);
}

/* ===========================
   EMPTY STATE
   =========================== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

/* ===========================
   INDIGO BUTTON OVERRIDE
   =========================== */

.btn-indigo {
    background: var(--accent-blue) !important;
    border-color: var(--accent-blue) !important;
}

.btn-indigo:hover {
    background: var(--accent-blue-hover) !important;
    border-color: var(--accent-blue-hover) !important;
}

/* ===========================
   BOT LOGS PAGE
   =========================== */

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.log-metadata-panel {
    padding: 1rem 1.25rem;
}

.log-metadata-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.log-metadata-json {
    background: var(--bg-base);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    overflow-x: auto;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.event-type-code {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

/* ===========================
   MARKET CONFIG PAGE (REDESIGNED)
   =========================== */

.market-config-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    align-items: start;
}

.market-info-card {
    padding: 1.5rem !important;
}

.market-info-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.market-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.market-info-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.market-info-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.market-info-desc {
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.5;
}

.market-info-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.bot-control-card {
    margin-top: 1rem;
    padding: 1.5rem !important;
}

.bot-control-status {
    margin-bottom: 1rem;
}

.bot-control-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Side Toggle Buttons */
.side-toggle-group {
    display: flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--input-border);
}

.side-toggle-btn {
    flex: 1;
    padding: 0.625rem 1.25rem;
    border: none;
    background: var(--input-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.side-toggle-btn:first-child {
    border-right: 1px solid var(--input-border);
}

.side-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.side-toggle-yes-active {
    background: var(--accent-green-bg) !important;
    color: var(--accent-green) !important;
    box-shadow: inset 0 0 0 1px var(--accent-green);
}

.side-toggle-no-active {
    background: var(--accent-red-bg) !important;
    color: var(--accent-red) !important;
    box-shadow: inset 0 0 0 1px var(--accent-red);
}

/* Risk Profile Auto Alert */
.risk-profile-alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    color: var(--accent-blue);
    font-size: 0.825rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.config-form-section .config-form-card {
    padding: 1.5rem !important;
}

/* ===========================
   AUDIT LOGS PAGE (REDESIGNED)
   =========================== */

.audit-action-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.audit-badge-create {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.audit-badge-delete {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.audit-badge-update {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-yellow);
}

.audit-badge-auth {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
}

.audit-badge-start {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green);
}

.audit-badge-stop {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

.entity-type-code {
    background: rgba(99, 102, 241, 0.08);
    color: var(--accent-blue);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.audit-detail-panel {
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.audit-detail-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.audit-detail-json {
    background: var(--bg-base);
    border: 1px solid var(--card-border);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    overflow-x: auto;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===========================
   WALLET DANGER ZONE
   =========================== */

.wallet-danger-card {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.wallet-danger-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.wallet-danger-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-red);
    margin: 0 0 0.25rem;
}

.wallet-danger-text {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* ===========================
   USER MANAGEMENT (REDESIGNED)
   =========================== */

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-role-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.role-admin {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-blue);
}

.role-viewer {
    background: rgba(107, 114, 128, 0.12);
    color: var(--text-muted);
}

.user-status-inactive {
    background: rgba(239, 68, 68, 0.10);
    color: var(--accent-red);
}

/* ===========================
   SYSTEM SETTINGS (REDESIGNED)
   =========================== */

.settings-card {
    margin-bottom: 1.5rem;
    padding: 1.5rem !important;
}

.settings-card-title {
    margin: 0 0 1.25rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===========================
   LOGIN PAGE (REDESIGNED)
   =========================== */

.login-logo-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent-blue), #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--accent-red-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--accent-red);
    font-size: 0.825rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.login-error-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    padding: 0;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: center;
}

.login-error-close:hover {
    opacity: 1;
}

/* ===========================
   RESPONSIVE — MARKET CONFIG LAYOUT
   =========================== */

@media (max-width: 1200px) {
    .market-config-layout {
        grid-template-columns: 1fr;
    }

    .audit-detail-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .wallet-danger-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .side-toggle-group {
        width: 100%;
    }

    .market-info-row {
        grid-template-columns: 1fr;
    }

    .bot-control-buttons {
        flex-direction: column;
    }
}

/* ===========================
   BOT CONTROLS
   =========================== */

.bot-controls {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--divider);
    flex-wrap: wrap;
}

.bot-controls .rz-button {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.625rem !important;
    border-radius: 0.375rem !important;
}

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

.opportunity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1200px) {
    .opportunity-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .opportunity-grid {
        grid-template-columns: 1fr;
    }
}

.opportunity-card {
    background: var(--card-bg) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-lg) !important;
    padding: 1.25rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.opportunity-card:hover {
    border-color: rgba(99, 102, 241, 0.25) !important;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.30);
}

.opp-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.opp-score-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    letter-spacing: 0.02em;
}

.opp-category-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.risk-low {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.risk-medium {
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
}

.risk-high {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.opp-market-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.opp-info-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.opp-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.opp-info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.opp-info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.opp-trade-suggestion {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(34, 211, 238, 0.06);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
}

.opp-profit {
    display: flex;
    align-items: center;
}

.opp-profit-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
}

.opp-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.opp-meta-item {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.opp-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
    margin-top: auto;
    border-top: 1px solid var(--divider);
}

.opp-polymarket-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.opp-polymarket-link:hover {
    color: var(--accent-blue-hover);
    text-decoration: underline;
}

/* ==================== Wizard strategy/profile cards ==================== */
.wizard-card-option {
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    padding: 1.25rem;
    text-align: center;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.wizard-card-option:hover {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.wizard-card-selected {
    border: 2px solid var(--rz-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.wizard-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.wizard-card-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.wizard-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wizard-summary-label {
    opacity: 0.7;
}

.wizard-summary-value {
    font-weight: 600;
}

.wizard-radio-inline .rz-radiobutton-list {
    display: inline-flex;
}

/* ── Tutorial page ────────────────────────────────────────── */

.tutorial-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tutorial-header h3 {
    margin: 0;
}

.tutorial-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--accent-blue);
}

.tutorial-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.95rem;
}

.tutorial-link:hover {
    text-decoration: underline;
}

.tutorial-callout {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    font-size: 0.9rem;
}

.tutorial-callout-info {
    background: rgba(99, 140, 255, 0.08);
    border-left: 3px solid var(--accent-blue);
}

.tutorial-callout-warning {
    background: rgba(255, 170, 51, 0.08);
    border-left: 3px solid var(--accent-yellow);
}

.tutorial-callout-success {
    background: rgba(74, 222, 128, 0.08);
    border-left: 3px solid #4ade80;
}

.tutorial-warn-inline {
    color: var(--accent-yellow);
    font-weight: 500;
}

.tutorial-img-container {
    margin: 1.25rem 0;
    text-align: center;
}

.tutorial-img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.tutorial-img-caption {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ===========================
   HELP TOOLTIPS
   =========================== */

.help-tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
}

.help-tooltip-icon {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    line-height: 1;
}

.help-tooltip-wrap:hover .help-tooltip-icon {
    opacity: 1;
    color: var(--accent-cyan, #00d4ff);
}

.help-tooltip-popup {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #151a28;
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.55;
    width: max-content;
    max-width: 340px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 212, 255, 0.15);
    z-index: 9999;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    white-space: normal;
    text-align: left;
}

.help-tooltip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: #151a28 transparent transparent transparent;
}

.help-tooltip-wrap:hover .help-tooltip-popup {
    visibility: visible;
    opacity: 1;
}

/* ===========================
   BOT TOAST NOTIFICATION
   =========================== */

.bot-toast-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.bot-toast {
    padding: 2rem 2.5rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    position: relative;
    animation: toast-in 0.3s ease-out;
}

.bot-toast-success {
    background: #0d2818;
    border: 2px solid #22c55e;
    color: #4ade80;
}

.bot-toast-error {
    background: #2a0a0a;
    border: 2px solid #ef4444;
    color: #fca5a5;
}

.bot-toast-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.bot-toast-success .bot-toast-icon { color: #22c55e; }
.bot-toast-error .bot-toast-icon { color: #ef4444; }

.bot-toast-text {
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
}

.bot-toast-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
}

.bot-toast-close:hover { color: #fff; }

@keyframes toast-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
