/* ==========================================================================
   RiskRadar Design System v2.0 — Brutal Red / Warm Gray
   Complete CSS architecture with dark (default) and light themes.
   All custom properties prefixed --rr-, all classes prefixed rr-.
   ========================================================================== */

/* ==========================================================================
   1. DESIGN TOKENS — Custom Properties
   ========================================================================== */

:root,
[data-theme="dark"] {
    /* Backgrounds — softer dark, not pure black */
    --rr-bg: #0E0E11;
    --rr-bg-secondary: #131317;
    --rr-surface: #1A1A1F;
    --rr-surface-hover: #222228;

    /* Accent */
    --rr-accent: #FF2020;
    --rr-accent-hover: #FF4040;
    --rr-accent-alpha-10: rgba(255, 32, 32, 0.1);
    --rr-accent-alpha-20: rgba(255, 32, 32, 0.2);

    /* Text — brighter secondary for readability */
    --rr-text-primary: #F0F0F2;
    --rr-text-secondary: rgba(255, 255, 255, 0.65);
    --rr-text-muted: rgba(255, 255, 255, 0.35);

    /* Borders — slightly more visible */
    --rr-border-subtle: rgba(255, 255, 255, 0.07);
    --rr-border-accent: rgba(255, 32, 32, 0.15);

    /* Semantic colors */
    --rr-success: #00E676;
    --rr-success-bg: rgba(0, 230, 118, 0.12);
    --rr-danger: #FF3C3C;
    --rr-danger-bg: rgba(255, 60, 60, 0.12);
    --rr-warning: #FFA500;
    --rr-warning-bg: rgba(255, 165, 0, 0.12);
    --rr-info: #3C82FF;
    --rr-info-bg: rgba(60, 130, 255, 0.12);

    /* Cards — more visible surface */
    --rr-card-bg: rgba(255, 255, 255, 0.05);
    --rr-card-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    --rr-card-border: var(--rr-border-subtle);
    --rr-card-radius: 12px;

    /* Inputs */
    --rr-input-bg: rgba(255, 255, 255, 0.04);
    --rr-input-border: rgba(255, 255, 255, 0.08);
    --rr-input-focus-border: var(--rr-accent);
    --rr-input-focus-shadow: 0 0 0 3px rgba(255, 32, 32, 0.15);

    /* Skeleton */
    --rr-skeleton-from: rgba(255, 255, 255, 0.03);
    --rr-skeleton-to: rgba(255, 255, 255, 0.07);

    /* Scrollbar */
    --rr-scrollbar-track: #131317;
    --rr-scrollbar-thumb: #2A2A30;

    /* Overlay */
    --rr-overlay: rgba(0, 0, 0, 0.6);

    /* Typography */
    --rr-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    --rr-font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;

    /* Sizing */
    --rr-sidebar-width: 220px;
    --rr-navbar-height: 56px;

    /* Transitions */
    --rr-transition-fast: 0.15s ease;
    --rr-transition-base: 0.2s ease;
    --rr-transition-slow: 0.3s ease;

    /* Z-indices */
    --rr-z-sidebar: 1000;
    --rr-z-navbar: 1010;
    --rr-z-overlay: 1020;
    --rr-z-toast: 9999;
}

/* --------------------------------------------------------------------------
   Light Theme
   -------------------------------------------------------------------------- */

[data-theme="light"] {
    --rr-bg: #F5F3F0;
    --rr-bg-secondary: #EDEAE6;
    --rr-surface: #FFFFFF;
    --rr-surface-hover: #F0EDE9;

    --rr-accent: #CC0000;
    --rr-accent-hover: #AA0000;
    --rr-accent-alpha-10: rgba(204, 0, 0, 0.1);
    --rr-accent-alpha-20: rgba(204, 0, 0, 0.2);

    --rr-text-primary: #1A1A1A;
    --rr-text-secondary: rgba(0, 0, 0, 0.5);
    --rr-text-muted: rgba(0, 0, 0, 0.3);

    --rr-border-subtle: rgba(0, 0, 0, 0.06);
    --rr-border-accent: rgba(204, 0, 0, 0.12);

    --rr-success: #008040;
    --rr-success-bg: rgba(0, 128, 64, 0.08);
    --rr-danger: #CC0000;
    --rr-danger-bg: rgba(204, 0, 0, 0.08);
    --rr-warning: #B87300;
    --rr-warning-bg: rgba(184, 115, 0, 0.08);
    --rr-info: #1A5CCC;
    --rr-info-bg: rgba(26, 92, 204, 0.08);

    --rr-card-bg: #FFFFFF;
    --rr-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --rr-card-border: rgba(0, 0, 0, 0.06);

    --rr-input-bg: #FFFFFF;
    --rr-input-border: rgba(0, 0, 0, 0.12);
    --rr-input-focus-border: var(--rr-accent);
    --rr-input-focus-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);

    --rr-skeleton-from: rgba(0, 0, 0, 0.04);
    --rr-skeleton-to: rgba(0, 0, 0, 0.08);

    --rr-scrollbar-track: #EDEAE6;
    --rr-scrollbar-thumb: #C8C4BE;

    --rr-overlay: rgba(0, 0, 0, 0.3);
}

/* System preference fallback */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --rr-bg: #F5F3F0;
        --rr-bg-secondary: #EDEAE6;
        --rr-surface: #FFFFFF;
        --rr-surface-hover: #F0EDE9;

        --rr-accent: #CC0000;
        --rr-accent-hover: #AA0000;
        --rr-accent-alpha-10: rgba(204, 0, 0, 0.1);
        --rr-accent-alpha-20: rgba(204, 0, 0, 0.2);

        --rr-text-primary: #1A1A1A;
        --rr-text-secondary: rgba(0, 0, 0, 0.5);
        --rr-text-muted: rgba(0, 0, 0, 0.3);

        --rr-border-subtle: rgba(0, 0, 0, 0.06);
        --rr-border-accent: rgba(204, 0, 0, 0.12);

        --rr-success: #008040;
        --rr-success-bg: rgba(0, 128, 64, 0.08);
        --rr-danger: #CC0000;
        --rr-danger-bg: rgba(204, 0, 0, 0.08);
        --rr-warning: #B87300;
        --rr-warning-bg: rgba(184, 115, 0, 0.08);
        --rr-info: #1A5CCC;
        --rr-info-bg: rgba(26, 92, 204, 0.08);

        --rr-card-bg: #FFFFFF;
        --rr-card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        --rr-card-border: rgba(0, 0, 0, 0.06);

        --rr-input-bg: #FFFFFF;
        --rr-input-border: rgba(0, 0, 0, 0.12);
        --rr-input-focus-border: var(--rr-accent);
        --rr-input-focus-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1);

        --rr-skeleton-from: rgba(0, 0, 0, 0.04);
        --rr-skeleton-to: rgba(0, 0, 0, 0.08);

        --rr-scrollbar-track: #EDEAE6;
        --rr-scrollbar-thumb: #C8C4BE;

        --rr-overlay: rgba(0, 0, 0, 0.3);
    }
}


/* ==========================================================================
   2. BASE — Reset, HTML, Body, Typography, Links
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--rr-bg);
    color: var(--rr-text-primary);
    font-family: var(--rr-font-family);
    font-size: 16px;
    line-height: 1.65;
    transition:
        background-color var(--rr-transition-base),
        color var(--rr-transition-base);
}

body {
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em;
    font-weight: 800;
    line-height: 1.2;
    color: var(--rr-text-primary);
    letter-spacing: -0.01em;
}

h1 { font-size: 2rem; font-weight: 900; }
h2 { font-size: 1.5rem; font-weight: 900; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin: 0 0 1em;
    color: var(--rr-text-secondary);
}

a {
    color: var(--rr-accent);
    text-decoration: none;
    transition: color var(--rr-transition-base);
}

a:hover,
a:focus-visible {
    color: var(--rr-accent-hover);
}

strong, b {
    font-weight: 700;
}

code, pre {
    font-family: var(--rr-font-mono);
}

code {
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    background: var(--rr-card-bg);
    border-radius: 4px;
    color: var(--rr-accent);
}

::selection {
    background: var(--rr-accent);
    color: #FFFFFF;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--rr-scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--rr-scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--rr-text-muted);
}


/* ==========================================================================
   3. LAYOUT — .rr-layout, .rr-sidebar, .rr-main
   ========================================================================== */

.rr-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.rr-main {
    flex: 1;
    margin-left: var(--rr-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--rr-transition-slow);
}

.rr-main-content {
    flex: 1;
    padding: 0;
    width: 100%;
}

/* Public pages: no sidebar, centered container */
.rr-public-main {
    margin-left: 0;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    padding: 0 24px;
}


/* ==========================================================================
   4. NAVBAR — .rr-navbar (public pages)
   ========================================================================== */

.rr-navbar {
    position: sticky;
    top: 0;
    z-index: var(--rr-z-navbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    padding: 0 40px;
    background: linear-gradient(180deg, rgba(14, 14, 17, 0.95) 0%, rgba(14, 14, 17, 0.85) 100%);
    border-bottom: 1px solid var(--rr-border-accent);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    transition: background-color var(--rr-transition-base);
}

[data-theme="light"] .rr-navbar {
    background: linear-gradient(180deg, rgba(245, 243, 240, 0.95) 0%, rgba(245, 243, 240, 0.85) 100%);
    border-bottom: 1px solid rgba(204, 0, 0, 0.1);
}

.rr-navbar-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.rr-navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rr-navbar-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}


/* ==========================================================================
   5. SIDEBAR — .rr-sidebar
   ========================================================================== */

.rr-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--rr-sidebar-width);
    z-index: var(--rr-z-sidebar);
    display: flex;
    flex-direction: column;
    background-color: var(--rr-bg);
    border-right: 1px solid var(--rr-border-subtle);
    overflow-y: auto;
    overflow-x: hidden;
    transition:
        transform var(--rr-transition-slow),
        background-color var(--rr-transition-base);
}

.rr-sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--rr-border-subtle);
    flex-shrink: 0;
}

.rr-sidebar-equity {
    padding: 16px;
    border-bottom: 1px solid var(--rr-border-subtle);
    flex-shrink: 0;
}

.rr-sidebar-regime {
    padding: 12px 16px;
    border-bottom: 1px solid var(--rr-border-subtle);
    flex-shrink: 0;
}

.rr-sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.rr-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--rr-border-subtle);
    flex-shrink: 0;
    font-size: 11px;
    color: var(--rr-text-muted);
}

/* Sidebar overlay for mobile */
.rr-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: calc(var(--rr-z-sidebar) - 1);
    background: var(--rr-overlay);
    opacity: 0;
    transition: opacity var(--rr-transition-slow);
}

.rr-sidebar-overlay.active {
    display: block;
    opacity: 1;
}


/* ==========================================================================
   6. LOGO — .rr-logo, .rr-logo-icon, .rr-logo-text
   ========================================================================== */

.rr-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--rr-text-primary);
}

.rr-logo:hover {
    color: var(--rr-text-primary);
    text-decoration: none;
}

.rr-logo:hover .rr-logo-icon {
    box-shadow: 0 0 20px rgba(255, 32, 32, 0.4);
}

.rr-logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FF2020 0%, #CC1010 100%);
    color: #FFFFFF;
    font-weight: 900;
    font-size: 20px;
    border-radius: 10px;
    flex-shrink: 0;
    line-height: 1;
    box-shadow: 0 4px 15px rgba(255, 32, 32, 0.25);
    transition: box-shadow var(--rr-transition-base);
}

.rr-logo-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--rr-text-primary);
    line-height: 1;
}

.rr-logo-highlight {
    color: var(--rr-accent);
}

.rr-btn-nav {
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.rr-nav-muted {
    opacity: 0.5;
}

.rr-nav-muted:hover {
    opacity: 1;
}


/* ==========================================================================
   7. NAV LINKS — .rr-nav-link
   ========================================================================== */

.rr-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--rr-border-subtle);
    border-radius: 10px;
    background: var(--rr-card-bg);
    color: var(--rr-text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: border-color var(--rr-transition-fast), color var(--rr-transition-fast), background-color var(--rr-transition-fast);
}

.rr-theme-toggle:hover {
    border-color: var(--rr-accent);
    color: var(--rr-accent);
    background: var(--rr-accent-alpha-10);
}

.rr-theme-icon {
    line-height: 1;
}

.rr-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-radius: 8px;
    color: var(--rr-text-secondary);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition:
        color var(--rr-transition-fast),
        background-color var(--rr-transition-fast);
    cursor: pointer;
    white-space: nowrap;
}

.rr-nav-link:hover {
    color: var(--rr-text-primary);
    background-color: var(--rr-surface);
    text-decoration: none;
}

.rr-nav-link.active {
    color: var(--rr-accent);
    background-color: var(--rr-accent-alpha-10);
}

.rr-nav-link-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
}

.rr-nav-link.active .rr-nav-link-icon {
    opacity: 1;
}


/* ==========================================================================
   8. CARDS — .rr-card
   ========================================================================== */

.rr-card {
    background: var(--rr-card-bg);
    border: 1px solid var(--rr-card-border);
    border-radius: var(--rr-card-radius);
    padding: 20px;
    box-shadow: var(--rr-card-shadow);
    transition:
        background-color var(--rr-transition-base),
        border-color var(--rr-transition-base),
        box-shadow var(--rr-transition-base);
}

.rr-card-header {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--rr-border-subtle);
}

.rr-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--rr-text-primary);
    margin: 0;
}

.rr-card-body {
    /* default padding handled by .rr-card */
}

.rr-card-compact {
    padding: 16px;
}


/* ==========================================================================
   9. SIGNAL ROWS — .rr-signal
   ========================================================================== */

.rr-signal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--rr-border-subtle);
    background: transparent;
    transition:
        background-color var(--rr-transition-fast),
        border-color var(--rr-transition-fast);
    cursor: default;
}

.rr-signal:hover {
    background: var(--rr-surface-hover);
}

.rr-signal-long {
    border-left-color: var(--rr-success);
}

.rr-signal-short {
    border-left-color: var(--rr-danger);
}

.rr-signal-skip {
    border-left-color: var(--rr-text-muted);
}

.rr-signal-symbol {
    font-weight: 700;
    font-size: 13px;
    color: var(--rr-text-primary);
    min-width: 80px;
}

.rr-signal-meta {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--rr-text-secondary);
}

.rr-signal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}


/* ==========================================================================
   10. DIRECTION BADGES — .rr-badge-long, .rr-badge-short, .rr-badge-skip
   ========================================================================== */

.rr-badge-long {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--rr-success-bg);
    color: var(--rr-success);
}

.rr-badge-short {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--rr-danger-bg);
    color: var(--rr-danger);
}

.rr-badge-skip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--rr-text-muted);
}

[data-theme="light"] .rr-badge-skip {
    background: rgba(0, 0, 0, 0.05);
}


/* ==========================================================================
   11. CONFIDENCE BAR — .rr-confidence
   ========================================================================== */

.rr-confidence {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--rr-border-subtle);
    overflow: hidden;
    position: relative;
}

.rr-confidence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width var(--rr-transition-slow);
    min-width: 2px;
}

.rr-confidence-fill-success {
    background: var(--rr-success);
}

.rr-confidence-fill-danger {
    background: var(--rr-danger);
}

.rr-confidence-fill-warning {
    background: var(--rr-warning);
}

.rr-confidence-fill-accent {
    background: var(--rr-accent);
}


/* ==========================================================================
   12. STAT CARDS — .rr-stat
   ========================================================================== */

.rr-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    gap: 4px;
}

.rr-stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--rr-text-primary);
    letter-spacing: -0.02em;
}

.rr-stat-value-sm {
    font-size: 20px;
}

.rr-stat-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rr-text-secondary);
}

.rr-stat-delta {
    font-size: 12px;
    font-weight: 600;
}

.rr-stat-delta-up {
    color: var(--rr-success);
}

.rr-stat-delta-down {
    color: var(--rr-danger);
}


/* ==========================================================================
   13. BUTTONS — .rr-btn-primary, .rr-btn-secondary, sizes
   ========================================================================== */

.rr-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--rr-accent) 0%, #CC1010 100%);
    color: #FFFFFF;
    font-family: var(--rr-font-family);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(255, 32, 32, 0.2);
    transition:
        background-color var(--rr-transition-fast),
        transform var(--rr-transition-fast),
        box-shadow var(--rr-transition-fast);
}

.rr-btn-primary:hover {
    background: linear-gradient(135deg, var(--rr-accent-hover) 0%, var(--rr-accent) 100%);
    color: #FFFFFF;
    text-decoration: none;
    box-shadow: 0 6px 25px rgba(255, 32, 32, 0.35);
}

.rr-btn-primary:active {
    transform: scale(0.97);
}

.rr-btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.rr-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--rr-text-secondary);
    font-family: var(--rr-font-family);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition:
        background-color var(--rr-transition-fast),
        color var(--rr-transition-fast),
        border-color var(--rr-transition-fast),
        transform var(--rr-transition-fast);
}

.rr-btn-secondary:hover {
    color: var(--rr-text-primary);
    border-color: var(--rr-text-muted);
    background: var(--rr-surface);
    text-decoration: none;
}

.rr-btn-secondary:active {
    transform: scale(0.97);
}

.rr-btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Size variants */
.rr-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 8px;
}

.rr-btn-lg {
    padding: 14px 28px;
    font-size: 15px;
    border-radius: 12px;
}


/* ==========================================================================
   14. INPUTS — .rr-input, .rr-select
   ========================================================================== */

.rr-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--rr-input-border);
    border-radius: 8px;
    background: var(--rr-input-bg);
    color: var(--rr-text-primary);
    font-family: var(--rr-font-family);
    font-size: 14px;
    line-height: 1.5;
    outline: none;
    transition:
        border-color var(--rr-transition-fast),
        box-shadow var(--rr-transition-fast),
        background-color var(--rr-transition-base);
}

.rr-input::placeholder {
    color: var(--rr-text-muted);
}

.rr-input:focus {
    border-color: var(--rr-input-focus-border);
    box-shadow: var(--rr-input-focus-shadow);
}

.rr-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rr-input-error {
    border-color: var(--rr-danger);
}

.rr-input-error:focus {
    border-color: var(--rr-danger);
    box-shadow: 0 0 0 3px rgba(255, 60, 60, 0.15);
}

.rr-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--rr-input-bg);
    border: 1px solid var(--rr-input-border);
    border-radius: 10px;
    padding: 10px 36px 10px 14px;
    color: var(--rr-text-primary);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--rr-font-family);
    cursor: pointer;
    min-width: 160px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.15s ease;
}

.rr-select:focus {
    outline: none;
    border-color: var(--rr-accent);
    box-shadow: var(--rr-input-focus-shadow);
}

.rr-select option {
    background: var(--rr-surface);
    color: var(--rr-text-primary);
}

.rr-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ==========================================================================
   15. TABS — .rr-tabs, .rr-tab
   ========================================================================== */

.rr-tabs {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--rr-border-subtle);
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rr-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--rr-text-secondary);
    font-family: var(--rr-font-family);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition:
        color var(--rr-transition-fast),
        border-color var(--rr-transition-fast);
}

.rr-tab:hover {
    color: var(--rr-text-primary);
}

.rr-tab.active {
    color: var(--rr-accent);
    border-bottom-color: var(--rr-accent);
}

.rr-tab:focus-visible {
    outline: 2px solid var(--rr-accent);
    outline-offset: -2px;
    border-radius: 4px 4px 0 0;
}


/* ==========================================================================
   16. TOAST — .rr-toast-container, .rr-toast
   ========================================================================== */

.rr-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: var(--rr-z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 32px);
}

.rr-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 10px;
    background: var(--rr-surface);
    border: 1px solid var(--rr-border-subtle);
    color: var(--rr-text-primary);
    font-size: 13px;
    line-height: 1.5;
    pointer-events: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: rr-toast-slide-in 0.3s ease-out forwards;
    transition:
        opacity var(--rr-transition-base),
        transform var(--rr-transition-base);
}

.rr-toast.rr-toast-exit {
    animation: rr-toast-slide-out 0.25s ease-in forwards;
}

.rr-toast-success {
    border-left: 3px solid var(--rr-success);
}

.rr-toast-error {
    border-left: 3px solid var(--rr-danger);
}

.rr-toast-warning {
    border-left: 3px solid var(--rr-warning);
}

.rr-toast-info {
    border-left: 3px solid var(--rr-info);
}

.rr-toast-message {
    flex: 1;
}

.rr-toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: var(--rr-text-muted);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    border-radius: 4px;
    transition: color var(--rr-transition-fast);
}

.rr-toast-close:hover {
    color: var(--rr-text-primary);
}

@keyframes rr-toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes rr-toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%) translateY(-8px);
    }
}


/* ==========================================================================
   17. SKELETON — .rr-skeleton
   ========================================================================== */

.rr-skeleton {
    background: linear-gradient(
        90deg,
        var(--rr-skeleton-from) 25%,
        var(--rr-skeleton-to) 50%,
        var(--rr-skeleton-from) 75%
    );
    background-size: 200% 100%;
    animation: rr-skeleton-pulse 1.8s ease-in-out infinite;
    border-radius: 6px;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}

.rr-skeleton * {
    visibility: hidden;
}

.rr-skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.rr-skeleton-text-sm {
    height: 10px;
    width: 60%;
}

.rr-skeleton-circle {
    border-radius: 50%;
}

@keyframes rr-skeleton-pulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}


/* ==========================================================================
   18. EXPANDABLE — .rr-expandable, .rr-expand-icon
   ========================================================================== */

.rr-expandable {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--rr-transition-slow) ease-out;
}

.rr-expandable.open {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
}

.rr-expand-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.rr-expand-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    transition: transform var(--rr-transition-base);
    flex-shrink: 0;
}

.rr-expandable.open ~ .rr-expand-trigger .rr-expand-icon,
.rr-expand-trigger.open .rr-expand-icon,
.open > .rr-expand-icon {
    transform: rotate(180deg);
}


/* ==========================================================================
   19. LABELS — .rr-label
   ========================================================================== */

.rr-label {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rr-text-secondary);
    line-height: 1;
}

.rr-label-lg {
    font-size: 11px;
    letter-spacing: 1.2px;
}

.rr-label-accent {
    color: var(--rr-accent);
}


/* ==========================================================================
   20. REGIME BADGES — .rr-regime-*
   ========================================================================== */

.rr-regime-bull {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--rr-success-bg);
    color: var(--rr-success);
}

.rr-regime-bear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--rr-danger-bg);
    color: var(--rr-danger);
}

.rr-regime-sideways {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--rr-warning-bg);
    color: var(--rr-warning);
}

.rr-regime-volatile {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--rr-info-bg);
    color: var(--rr-info);
}


/* ==========================================================================
   21. HERO — .rr-hero
   ========================================================================== */

.rr-hero {
    position: relative;
    overflow: hidden;
    padding: 100px 40px 80px;
    text-align: center;
}

.rr-hero-glow {
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 1000px;
    height: 700px;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 32, 32, 0.1) 0%,
        rgba(255, 32, 32, 0.03) 40%,
        transparent 65%
    );
    pointer-events: none;
    z-index: 0;
    animation: rr-glow-pulse 6s ease-in-out infinite;
}

@keyframes rr-glow-pulse {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

[data-theme="light"] .rr-hero-glow {
    background: radial-gradient(
        ellipse at center,
        rgba(204, 0, 0, 0.06) 0%,
        rgba(204, 0, 0, 0.02) 40%,
        transparent 65%
    );
}

.rr-hero-title {
    position: relative;
    z-index: 1;
    font-size: 56px;
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 0.5em;
    color: var(--rr-text-primary);
    animation: rr-hero-fade-up 0.8s ease-out;
}

.rr-hero-subtitle {
    position: relative;
    z-index: 1;
    font-size: 20px;
    font-weight: 400;
    color: var(--rr-text-secondary);
    max-width: 560px;
    margin: 0 auto 40px;
    line-height: 1.7;
    animation: rr-hero-fade-up 0.8s ease-out 0.15s both;
}

.rr-hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    animation: rr-hero-fade-up 0.8s ease-out 0.3s both;
}

@keyframes rr-hero-fade-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.rr-accent {
    color: var(--rr-accent);
}

/* Landing page section animations */
.rr-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.rr-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stats bar animation */
.rr-stats-bar {
    animation: rr-hero-fade-up 0.8s ease-out 0.45s both;
}


/* ==========================================================================
   22. FOOTER — .rr-footer
   ========================================================================== */

.rr-footer {
    border-top: 1px solid var(--rr-border-subtle);
    padding: 20px 24px;
    text-align: center;
    color: var(--rr-text-muted);
    font-size: 12px;
    flex-shrink: 0;
    margin-top: auto;
    transition:
        border-color var(--rr-transition-base),
        color var(--rr-transition-base);
}

.rr-footer a {
    color: var(--rr-text-secondary);
}

.rr-footer a:hover {
    color: var(--rr-accent);
}


/* ==========================================================================
   23. HAMBURGER — .rr-hamburger
   ========================================================================== */

.rr-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border: none;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    z-index: calc(var(--rr-z-sidebar) + 1);
    transition: background-color var(--rr-transition-fast);
}

.rr-hamburger:hover {
    background: var(--rr-surface);
}

.rr-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--rr-text-secondary);
    border-radius: 1px;
    transition:
        transform var(--rr-transition-base),
        opacity var(--rr-transition-base),
        background-color var(--rr-transition-base);
}

/* Active / open state */
.rr-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.rr-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.rr-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


/* ==========================================================================
   24. RESPONSIVE — Mobile (<= 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .rr-sidebar {
        transform: translateX(-100%);
    }

    .rr-sidebar.open {
        transform: translateX(0);
    }

    .rr-main {
        margin-left: 0;
    }

    .rr-hamburger {
        display: flex;
    }

    .rr-navbar-links {
        display: none;
    }

    .rr-navbar-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--rr-bg);
        border-bottom: 1px solid var(--rr-border-accent);
        padding: 16px;
        gap: 8px;
        z-index: 1000;
    }

    .rr-hero {
        padding: 48px 16px;
    }

    .rr-hero-title {
        font-size: 32px;
    }

    .rr-hero-subtitle {
        font-size: 15px;
    }

    .rr-main-content {
        padding: 16px;
    }

    .rr-toast-container {
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .rr-hero-title {
        font-size: 28px;
    }

    .rr-hero {
        padding: 36px 12px;
    }

    .rr-card {
        padding: 14px;
        border-radius: 10px;
    }

    .rr-stat-value {
        font-size: 22px;
    }
}


/* ==========================================================================
   25. UTILITY CLASSES
   ========================================================================== */

/* Text colors */
.rr-text-primary { color: var(--rr-text-primary); }
.rr-text-secondary { color: var(--rr-text-secondary); }
.rr-text-muted { color: var(--rr-text-muted); }
.rr-text-success { color: var(--rr-success); }
.rr-text-danger { color: var(--rr-danger); }
.rr-text-warning { color: var(--rr-warning); }
.rr-text-info { color: var(--rr-info); }

/* Backgrounds */
.rr-bg-surface { background-color: var(--rr-surface); }
.rr-bg-card { background: var(--rr-card-bg); }

/* Borders */
.rr-border-subtle { border-color: var(--rr-border-subtle); }
.rr-border-accent { border-color: var(--rr-border-accent); }

/* Flex helpers */
.rr-flex { display: flex; }
.rr-flex-col { display: flex; flex-direction: column; }
.rr-flex-center { display: flex; align-items: center; justify-content: center; }
.rr-flex-between { display: flex; align-items: center; justify-content: space-between; }
.rr-flex-wrap { flex-wrap: wrap; }
.rr-flex-1 { flex: 1; }
.rr-items-center { align-items: center; }
.rr-justify-center { justify-content: center; }

/* Gap */
.rr-gap-4 { gap: 4px; }
.rr-gap-8 { gap: 8px; }
.rr-gap-12 { gap: 12px; }
.rr-gap-16 { gap: 16px; }
.rr-gap-24 { gap: 24px; }

/* Spacing */
.rr-mt-0 { margin-top: 0; }
.rr-mt-8 { margin-top: 8px; }
.rr-mt-16 { margin-top: 16px; }
.rr-mt-24 { margin-top: 24px; }
.rr-mt-32 { margin-top: 32px; }
.rr-mb-0 { margin-bottom: 0; }
.rr-mb-8 { margin-bottom: 8px; }
.rr-mb-16 { margin-bottom: 16px; }
.rr-mb-24 { margin-bottom: 24px; }
.rr-p-0 { padding: 0; }
.rr-p-8 { padding: 8px; }
.rr-p-16 { padding: 16px; }
.rr-p-24 { padding: 24px; }

/* Width */
.rr-w-full { width: 100%; }

/* Text alignment */
.rr-text-center { text-align: center; }
.rr-text-right { text-align: right; }
.rr-text-left { text-align: left; }

/* Font */
.rr-font-mono { font-family: var(--rr-font-mono); }
.rr-font-bold { font-weight: 700; }
.rr-font-black { font-weight: 900; }
.rr-text-xs { font-size: 11px; }
.rr-text-sm { font-size: 12px; }
.rr-text-base { font-size: 14px; }
.rr-text-lg { font-size: 16px; }
.rr-text-xl { font-size: 20px; }
.rr-text-2xl { font-size: 28px; }
.rr-uppercase { text-transform: uppercase; letter-spacing: 0.5px; }

/* Truncation */
.rr-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Grid */
.rr-grid {
    display: grid;
    gap: 16px;
}

.rr-grid-2 { grid-template-columns: repeat(2, 1fr); }
.rr-grid-3 { grid-template-columns: repeat(3, 1fr); }
.rr-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .rr-grid-2,
    .rr-grid-3,
    .rr-grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .rr-grid-3,
    .rr-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Divider */
.rr-divider {
    border: none;
    border-top: 1px solid var(--rr-border-subtle);
    margin: 16px 0;
}

/* Hide / Show */
.rr-hide { display: none !important; }

.rr-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ==========================================================================
   26. ALERTS (semantic, standalone)
   ========================================================================== */

.rr-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.rr-alert-success {
    background: var(--rr-success-bg);
    color: var(--rr-success);
    border-color: var(--rr-success);
}

.rr-alert-danger {
    background: var(--rr-danger-bg);
    color: var(--rr-danger);
    border-color: var(--rr-danger);
}

.rr-alert-warning {
    background: var(--rr-warning-bg);
    color: var(--rr-warning);
    border-color: var(--rr-warning);
}

.rr-alert-info {
    background: var(--rr-info-bg);
    color: var(--rr-info);
    border-color: var(--rr-info);
}


/* ==========================================================================
   27. TABLE — .rr-table
   ========================================================================== */

.rr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rr-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--rr-text-muted);
    border-bottom: 1px solid var(--rr-border-subtle);
    white-space: nowrap;
}

.rr-table td {
    padding: 10px 12px;
    color: var(--rr-text-secondary);
    border-bottom: 1px solid var(--rr-border-subtle);
    vertical-align: middle;
}

.rr-table tbody tr {
    transition: background-color var(--rr-transition-fast);
}

.rr-table tbody tr:hover {
    background: var(--rr-surface-hover);
}

.rr-table tbody tr:last-child td {
    border-bottom: none;
}


/* ==========================================================================
   28. SCROLLABLE CONTAINER
   ========================================================================== */

.rr-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rr-scroll-y {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}


/* ==========================================================================
   29. ANIMATIONS
   ========================================================================== */

@keyframes rr-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rr-slide-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes rr-slide-down {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rr-animate-fade-in {
    animation: rr-fade-in 0.3s ease-out forwards;
}

.rr-animate-slide-up {
    animation: rr-slide-up 0.3s ease-out forwards;
}

.rr-animate-slide-down {
    animation: rr-slide-down 0.3s ease-out forwards;
}


/* ==========================================================================
   30. THEME TRANSITION SMOOTHING
   ========================================================================== */

html.rr-theme-transitioning,
html.rr-theme-transitioning *,
html.rr-theme-transitioning *::before,
html.rr-theme-transitioning *::after {
    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease !important;
}


/* ==========================================================================
   31. APP BAR — Replaces sidebar for authenticated pages
   ========================================================================== */

.rr-appbar {
    position: sticky;
    top: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 24px;
    background: linear-gradient(180deg, rgba(14, 14, 17, 0.97) 0%, rgba(14, 14, 17, 0.92) 100%);
    border-bottom: 1px solid var(--rr-border-accent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .rr-appbar {
    background: linear-gradient(180deg, rgba(245, 243, 240, 0.97) 0%, rgba(245, 243, 240, 0.92) 100%);
}

.rr-appbar-left, .rr-appbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.rr-appbar-nav {
    display: flex;
    gap: 4px;
}

.rr-appbar-link {
    padding: 8px 20px;
    border-radius: 8px;
    color: var(--rr-text-secondary);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.rr-appbar-link:hover {
    color: var(--rr-text-primary);
    background: var(--rr-card-bg);
    text-decoration: none;
}

.rr-appbar-link.active {
    color: var(--rr-accent);
    background: var(--rr-accent-alpha-10);
}

.rr-appbar-logout {
    opacity: 0.5;
    font-size: 13px;
}

.rr-appbar-logout:hover {
    opacity: 1;
}

.rr-appbar-equity {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.rr-appbar-equity .rr-equity-value {
    font-weight: 800;
    color: var(--rr-text-primary);
}

.rr-appbar-equity .rr-equity-change {
    font-weight: 700;
    font-size: 13px;
}

/* App main content — replaces rr-main for appbar layout */
.rr-app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 48px;
}

/* Bigger tabs */
.rr-tabs-lg .rr-tab {
    font-size: 18px;
    font-weight: 700;
    padding: 16px 32px;
}


/* ==========================================================================
   32. RIGHT DRAWER PANEL
   ========================================================================== */

.rr-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--rr-bg-secondary);
    border-left: 1px solid var(--rr-border-subtle);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

.rr-drawer.open {
    right: 0;
}

.rr-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.rr-drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.rr-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--rr-border-subtle);
}

.rr-drawer-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.rr-drawer-close {
    background: none;
    border: none;
    color: var(--rr-text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
}

.rr-drawer-close:hover {
    color: var(--rr-text-primary);
}

.rr-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* History card in drawer */
.rr-history-card {
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--rr-card-bg);
    border: 1px solid var(--rr-card-border);
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.rr-history-card:hover {
    border-color: var(--rr-accent);
    background: var(--rr-accent-alpha-10);
}

/* Floating history button (FAB) */
.rr-history-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--rr-accent) 0%, #CC1010 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 25px rgba(255, 32, 32, 0.3);
    z-index: 1030;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rr-history-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 35px rgba(255, 32, 32, 0.45);
}

.rr-history-fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--rr-text-primary);
    color: var(--rr-bg);
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Better expandable triggers */
.rr-expand-trigger {
    cursor: pointer;
    padding: 14px 20px;
    border-radius: 10px;
    background: var(--rr-card-bg);
    border: 1px solid var(--rr-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.rr-expand-trigger:hover {
    background: var(--rr-surface-hover);
    border-color: var(--rr-text-muted);
}


/* ==========================================================================
   33. APP BAR / DRAWER — Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .rr-appbar {
        padding: 0 12px;
        height: 56px;
        overflow: hidden;
    }
    .rr-appbar-right {
        gap: 8px;
        flex-shrink: 0;
        overflow: hidden;
    }
    .rr-appbar-equity {
        display: flex;
        font-size: 12px;
        gap: 4px;
    }
    .rr-appbar-equity .rr-label {
        display: none;
    }
    .rr-appbar-regime {
        display: none;
    }
    .rr-appbar-nav {
        gap: 0;
    }
    .rr-appbar-link {
        padding: 6px 10px;
        font-size: 13px;
    }
    .rr-appbar-logout {
        padding: 6px 8px;
        font-size: 12px;
        white-space: nowrap;
    }
    .rr-drawer {
        width: 85vw;
        right: -85vw;
    }
    .rr-tabs-lg .rr-tab {
        font-size: 14px;
        padding: 12px 16px;
    }
    .rr-app-main {
        padding: 16px 12px;
    }
}

/* Trading signals 2-column grid */
.rr-signals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.rr-signals-grid > .rr-signal-cell {
    min-width: 0;
}

.rr-signals-grid > .rr-card {
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .rr-signals-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   SIGNAL — High-confidence glow & dimmed SKIP states
   ========================================================================== */

.rr-signal-high-confidence {
    box-shadow: inset 3px 0 0 0 rgba(255, 200, 50, 0.6),
                0 0 12px rgba(255, 200, 50, 0.08);
    border-left-color: rgba(255, 200, 50, 0.8);
}

.rr-signal-dimmed {
    opacity: 0.5;
}

.rr-signal-dimmed:hover {
    opacity: 0.75;
}

/* Signal expand chevron */
.rr-signal-chevron {
    color: var(--rr-text-muted);
    transition: transform 0.2s ease;
}
.rr-signal-cell.expanded .rr-signal-chevron {
    transform: rotate(180deg);
}

/* Direction explanation text under badges */
.rr-signal-explanation {
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
}

/* ==========================================================================
   POSITION CARD — Enhanced layout
   ========================================================================== */

.rr-position-card {
    flex-wrap: wrap;
}

.rr-position-levels {
    flex-wrap: wrap;
}

.rr-items-end {
    align-items: flex-end;
}

.rr-gap-2 {
    gap: 2px;
}

.rr-mt-4 {
    margin-top: 4px;
}
