/* FX Tools - Premium Modern Design System */
/* Inspired by shadcn/ui, Linear, Vercel */

/* ==================== CSS RESET & BASE ==================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== APP LOADER ==================== */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-base, #05060a);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-default, #23262f);
    border-top-color: var(--accent, #2563eb);
    border-radius: 50%;
    animation: loaderSpin 0.8s linear infinite;
}

@keyframes loaderSpin {
    to { transform: rotate(360deg); }
}

.loader-text {
    font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: 0.9375rem;
    color: var(--fg-muted, #9ca3b0);
    letter-spacing: 0.02em;
}

/* ==================== DESIGN TOKENS ==================== */
:root {
    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Spacing */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Monaco, monospace;

    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 120ms;
    --duration: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 500ms;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #34d399;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --info: #3b82f6;
    --info-light: #60a5fa;
    --purple: #8b5cf6;
    --purple-light: #a78bfa;
    --cyan: #06b6d4;
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"], :root {
    --bg-base: #05060a;
    --bg-surface: #0c0d12;
    --bg-elevated: #12141a;
    --bg-overlay: #1a1c24;
    --bg-subtle: #22252e;

    --fg-default: #f0f2f5;
    --fg-muted: #9ca3b0;
    --fg-subtle: #6b7280;
    --fg-faint: #4b5563;

    --border-default: #23262f;
    --border-muted: #1a1c24;
    --border-emphasis: #2d313c;

    --accent: #2563eb;
    --accent-hover: #3b82f6;
    --accent-muted: rgba(37, 99, 235, 0.18);
    --accent-subtle: rgba(37, 99, 235, 0.10);

    --glass-bg: rgba(12, 13, 18, 0.8);
    --glass-border: rgba(255, 255, 255, 0.06);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.2);
    --shadow-success: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-danger: 0 0 20px rgba(239, 68, 68, 0.3);

    --gradient-surface: linear-gradient(145deg, rgba(18, 20, 26, 0.9), rgba(12, 13, 18, 0.95));
    --gradient-card: linear-gradient(145deg, rgba(26, 28, 36, 0.6), rgba(18, 20, 26, 0.8));
    --gradient-border: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    --gradient-accent: linear-gradient(135deg, #2563eb, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);

    /* Legacy mappings */
    --background: var(--bg-base);
    --background-secondary: var(--bg-surface);
    --card: var(--bg-elevated);
    --card-hover: var(--bg-overlay);
    --foreground: var(--fg-default);
    --foreground-secondary: var(--fg-muted);
    --foreground-muted: var(--fg-subtle);
    --border: var(--border-default);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --muted: var(--bg-overlay);
    --input-border: var(--border-emphasis);
    --popover: var(--bg-elevated);
}

/* ==================== LIGHT THEME ==================== */
[data-theme="light"] {
    --bg-base: #fafbfc;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-overlay: #f3f4f6;
    --bg-subtle: #e5e7eb;

    --fg-default: #111827;
    --fg-muted: #4b5563;
    --fg-subtle: #6b7280;
    --fg-faint: #9ca3af;

    --border-default: #e5e7eb;
    --border-muted: #f3f4f6;
    --border-emphasis: #d1d5db;

    --accent: #1d4ed8;
    --accent-hover: #2563eb;
    --accent-muted: rgba(29, 78, 216, 0.15);
    --accent-subtle: rgba(29, 78, 216, 0.08);

    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.06);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(29, 78, 216, 0.15);
    --shadow-success: 0 0 20px rgba(16, 185, 129, 0.15);
    --shadow-danger: 0 0 20px rgba(239, 68, 68, 0.15);

    --gradient-surface: linear-gradient(145deg, #ffffff, #fafbfc);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(249, 250, 251, 0.95));
    --gradient-border: linear-gradient(145deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.02));
    --gradient-accent: linear-gradient(135deg, #1d4ed8, #3b82f6);
    --gradient-success: linear-gradient(135deg, #059669, #10b981);
    --gradient-danger: linear-gradient(135deg, #dc2626, #ef4444);

    /* Legacy mappings */
    --background: var(--bg-base);
    --background-secondary: var(--bg-surface);
    --card: var(--bg-elevated);
    --card-hover: var(--bg-overlay);
    --foreground: var(--fg-default);
    --foreground-secondary: var(--fg-muted);
    --foreground-muted: var(--fg-subtle);
    --border: var(--border-default);
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --muted: var(--bg-overlay);
    --input-border: var(--border-emphasis);
    --popover: var(--bg-elevated);
}

/* ==================== GLOBAL STYLES ==================== */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--fg-default);
    line-height: 1.6;
    font-size: var(--text-base);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== APP LAYOUT ==================== */
.app-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    margin-right: 340px;
    transition: margin-right var(--duration-slow) var(--ease-out);
}

.app-container.sidebar-hidden {
    margin-right: 0;
}

.main-content {
    grid-area: main;
    padding: var(--space-6);
    overflow-y: auto;
    background: var(--bg-base);
}

/* ==================== TOP BAR ==================== */
.top-bar {
    grid-area: topbar;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-6);
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left h1 {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--fg-default);
    letter-spacing: -0.02em;
}

.top-bar-left h1 i {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: var(--text-xl);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ==================== ICON BUTTONS ==================== */
.btn-icon,
.theme-toggle-btn,
.sidebar-toggle-btn,
.language-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--fg-muted);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn-icon:hover,
.theme-toggle-btn:hover,
.sidebar-toggle-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.theme-toggle-btn i {
    position: absolute;
    font-size: 1rem;
    transition: all var(--duration-slow) var(--ease-out);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

[data-theme="light"] .theme-icon-light {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

[data-theme="light"] .theme-icon-dark {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ==================== LANGUAGE SELECTOR ==================== */
.language-selector {
    position: relative;
}

.language-btn {
    width: auto;
    padding: 0 var(--space-3);
    gap: var(--space-2);
}

.language-code {
    font-weight: var(--font-semibold);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all var(--duration) var(--ease-out);
    z-index: 1000;
    overflow: hidden;
}

.language-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.language-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    color: var(--fg-default);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--duration-fast);
    text-align: left;
}

.language-option:hover {
    background: var(--bg-overlay);
}

.language-option.active {
    background: var(--accent-muted);
    color: var(--accent);
}

/* ==================== USER MENU ==================== */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--fg-default);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.user-menu-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--border-emphasis);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-xs);
    color: white;
}

.user-name {
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-btn i.fa-chevron-down {
    font-size: 10px;
    color: var(--fg-subtle);
    transition: transform var(--duration) var(--ease-out);
}

.user-menu.open .user-menu-btn i.fa-chevron-down {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.96);
    transition: all var(--duration) var(--ease-out);
    z-index: 1000;
    overflow: hidden;
}

.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-overlay);
}

.user-email {
    font-size: var(--text-sm);
    color: var(--fg-default);
    word-break: break-all;
}

.user-role {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    font-weight: var(--font-semibold);
    margin-top: 4px;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-default);
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--fg-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: all var(--duration-fast);
}

.user-dropdown-item:hover {
    background: var(--bg-overlay);
    color: var(--fg-default);
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: var(--text-sm);
}

.user-dropdown-item.logout {
    color: var(--danger);
}

.user-dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ==================== CALCULATOR LAYOUT ==================== */
.calculator-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

/* ==================== CARD STYLES ==================== */
.input-section,
.results-section {
    background: var(--gradient-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.input-section::before,
.results-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-muted), transparent);
    opacity: 0.5;
}

.input-section h2,
.results-section h2 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-3);
    color: var(--fg-default);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: -0.01em;
}

.input-section h2 i,
.results-section h2 i {
    color: var(--accent);
    font-size: var(--text-sm);
}

/* ==================== FORM ELEMENTS ==================== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.form-group {
    margin-bottom: var(--space-3);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-weight: var(--font-medium);
    color: var(--fg-muted);
    font-size: var(--text-sm);
}

.form-group input,
.form-group select {
    width: 100%;
    height: 40px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    background: var(--bg-base);
    color: var(--fg-default);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    transition: all var(--duration) var(--ease-out);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--border-emphasis);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group input::placeholder {
    color: var(--fg-faint);
}

/* ==================== LIVE PRICE BOX ==================== */
.live-price-spread-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.live-price-box,
.spread-box {
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: var(--space-3);
    transition: all var(--duration) var(--ease-out);
}

.live-price-box:hover,
.spread-box:hover {
    border-color: var(--border-emphasis);
}

.live-price-header,
.spread-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--fg-subtle);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-medium);
}

.live-price-value {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.live-price {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--success);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.refresh-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    color: var(--fg-subtle);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.refresh-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(180deg);
}

.spread-box input {
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    color: var(--fg-default);
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    width: 100%;
    font-variant-numeric: tabular-nums;
    transition: all var(--duration) var(--ease-out);
}

.spread-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.price-status {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}

.status-live {
    color: var(--success);
}

.status-cached {
    color: var(--warning);
}

.status-error {
    color: var(--danger);
}

.use-live-btn {
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.use-live-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* ==================== SELECT2 STYLING ==================== */
.select2-container {
    width: 100% !important;
}

.select2-container--default .select2-selection--single {
    background: var(--bg-base) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-md) !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 var(--space-4) !important;
    transition: all var(--duration) var(--ease-out) !important;
}

.select2-container--default .select2-selection--single:hover {
    border-color: var(--border-emphasis) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--fg-default) !important;
    line-height: 44px !important;
    padding: 0 !important;
    font-size: var(--text-sm) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px !important;
    right: 12px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--fg-subtle) transparent transparent transparent !important;
}

.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-muted) !important;
}

.select2-dropdown {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius-lg) !important;
    margin-top: 8px !important;
    box-shadow: var(--shadow-lg) !important;
    z-index: 9999 !important;
    overflow: hidden !important;
}

.select2-container--default .select2-search--dropdown {
    padding: var(--space-3) !important;
    background: var(--bg-overlay) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background: var(--bg-base) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: var(--radius) !important;
    color: var(--fg-default) !important;
    padding: var(--space-2) var(--space-3) !important;
    font-size: var(--text-sm) !important;
}

.select2-container--default .select2-results__option {
    padding: var(--space-3) var(--space-4) !important;
    color: var(--fg-default) !important;
    font-size: var(--text-sm) !important;
    transition: background var(--duration-fast) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: var(--accent) !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background: var(--accent-muted) !important;
    color: var(--accent) !important;
}

.select2-container--default .select2-results__group {
    color: var(--fg-subtle) !important;
    font-weight: var(--font-semibold) !important;
    padding: var(--space-3) var(--space-4) !important;
    font-size: var(--text-xs) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    background: var(--bg-overlay) !important;
}

/* ==================== BUTTON ROW ==================== */
.button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.calculate-btn,
.add-trade-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 42px;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.calculate-btn {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.add-trade-btn {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.add-trade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

/* ==================== RESULTS SECTION ==================== */
.lots-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.lot-item {
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
    text-align: center;
    transition: all var(--duration) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.lot-item:hover {
    border-color: var(--border-emphasis);
    transform: translateY(-2px);
}

.lot-item.highlight {
    background: var(--accent-subtle);
    border-color: var(--accent);
}

.lot-item.highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
}

.lot-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--fg-subtle);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-medium);
}

.lot-value {
    display: block;
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--fg-default);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.lot-item.highlight .lot-value {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lot-unit {
    display: block;
    font-size: var(--text-xs);
    color: var(--fg-faint);
    margin-top: var(--space-1);
}

/* ==================== RESULTS GRID ==================== */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

.result-card {
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all var(--duration) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.result-card:hover {
    border-color: var(--border-emphasis);
    transform: translateY(-2px);
}

.result-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border-default);
    transition: background var(--duration);
}

.result-card.danger::before {
    background: var(--gradient-danger);
}

.result-card.success::before {
    background: var(--gradient-success);
}

.result-card.highlight::before {
    background: var(--gradient-accent);
}

.result-card.spread-cost::before {
    background: linear-gradient(180deg, var(--warning), var(--warning-light));
}

.result-card.commission-cost::before {
    background: linear-gradient(180deg, var(--purple), var(--purple-light));
}

.result-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-icon i {
    font-size: var(--text-sm);
    color: var(--fg-muted);
}

.result-card.danger .result-icon {
    background: rgba(239, 68, 68, 0.1);
}

.result-card.danger .result-icon i {
    color: var(--danger);
}

.result-card.success .result-icon {
    background: rgba(16, 185, 129, 0.1);
}

.result-card.success .result-icon i {
    color: var(--success);
}

.result-card.spread-cost .result-icon {
    background: rgba(245, 158, 11, 0.1);
}

.result-card.spread-cost .result-icon i {
    color: var(--warning);
}

.result-card.commission-cost .result-icon {
    background: rgba(139, 92, 246, 0.1);
}

.result-card.commission-cost .result-icon i {
    color: var(--purple);
}

.result-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.result-label {
    font-size: var(--text-xs);
    color: var(--fg-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-medium);
}

.result-value {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--fg-default);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.result-card.danger .result-value {
    color: var(--danger);
}

.result-card.success .result-value {
    color: var(--success);
}

.result-card.spread-cost .result-value {
    color: var(--warning);
}

.result-card.commission-cost .result-value {
    color: var(--purple);
}

.result-unit {
    font-size: var(--text-xs);
    color: var(--fg-faint);
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 340px;
    min-width: 320px;
    max-width: 480px;
    background: var(--bg-base);
    border-left: 1px solid var(--border-emphasis);
    display: flex;
    flex-direction: column;
    z-index: 90;
    transition: transform var(--duration-slow) var(--ease-out), width var(--duration-slow) var(--ease-out);
}

.sidebar.collapsed {
    transform: translateX(100%);
}

.sidebar-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: ew-resize;
    background: transparent;
    transition: background var(--duration);
}

.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
    background: var(--accent);
}

/* ==================== JOURNAL SECTION ==================== */
.journal-section {
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: var(--bg-base);
    min-width: 0;
}

.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    gap: var(--space-2);
}

.journal-header h2 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.journal-header h2 i {
    color: var(--accent);
}

.journal-header-buttons {
    display: flex;
    gap: var(--space-2);
}

.view-toggle-btn,
.view-mode-btn,
.sidebar-close-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    color: var(--fg-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle-btn:hover,
.view-toggle-btn.active,
.view-mode-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.sidebar-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* ==================== JOURNAL STATS ==================== */
.journal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.journal-stats .stat {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-overlay);
    color: var(--fg-muted);
    font-weight: var(--font-semibold);
    border: 1px solid var(--border-default);
    white-space: nowrap;
}

.journal-stats .stat.open {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
}

.journal-stats .stat.win {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.journal-stats .stat.loss {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* ==================== JOURNAL FILTERS ==================== */
.journal-filters {
    display: flex;
    background: var(--bg-overlay);
    padding: 2px;
    border-radius: var(--radius);
    border: 1px solid var(--border-default);
    margin-bottom: var(--space-3);
}

.filter-btn {
    flex: 1;
    padding: var(--space-1) var(--space-2);
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--fg-muted);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.filter-btn:hover {
    color: var(--fg-default);
}

.filter-btn.active {
    background: var(--bg-base);
    color: var(--fg-default);
    box-shadow: var(--shadow-sm);
}

/* ==================== TRADES CONTAINER ==================== */
.trades-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-right: var(--space-2);
}

.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--fg-subtle);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.3;
    color: var(--fg-faint);
}

.empty-state p {
    font-size: var(--text-sm);
}

/* ==================== TRADE CARD - CLEAN DESIGN ==================== */
.trade-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--duration) var(--ease-out);
    position: relative;
}

.trade-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border-default);
}

.trade-card:hover {
    border-color: var(--border-emphasis);
}

.trade-card.open::before { background: var(--accent); }
.trade-card.win::before { background: var(--success); }
.trade-card.loss::before { background: var(--danger); }

/* Expanded state */
.trade-card:not(.collapsed) {
    border-color: var(--border-emphasis);
    box-shadow: var(--shadow);
}

.trade-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    background: transparent;
    transition: background var(--duration);
    gap: var(--space-2);
}

.trade-card:not(.collapsed) .trade-card-header {
    background: var(--bg-elevated);
}

.trade-toggle-icon {
    font-size: 10px;
    color: var(--fg-faint);
    transition: transform var(--duration);
}

.trade-card.collapsed .trade-toggle-icon {
    transform: rotate(-90deg);
}

/* Expanded/Collapsed states */
.trade-card-body {
    display: grid;
}

.trade-card-footer {
    display: flex;
}

.trade-card.collapsed .trade-card-body,
.trade-card.collapsed .trade-card-footer {
    display: none;
}

.trade-pair {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
    flex-shrink: 1;
}

.trade-pair-name {
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
}

.trade-direction {
    font-size: 9px;
    padding: 2px 5px;
    border-radius: var(--radius-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
}

.trade-direction.buy {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.trade-direction.sell {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.trade-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

/* Current price in header */
.trade-current-price {
    font-size: var(--text-xs);
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
}

/* Lots in header */
.trade-lots {
    font-size: var(--text-xs);
    color: var(--fg-subtle);
}

/* P&L in header for closed trades */
.trade-header-pnl {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    font-variant-numeric: tabular-nums;
}

.trade-header-pnl.profit { color: var(--success); }
.trade-header-pnl.loss { color: var(--danger); }

.trade-status {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
}

.trade-status.open {
    background: var(--accent-muted);
    color: var(--accent);
}

.trade-status.win {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}

.trade-status.loss {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

/* Trade Card Body - Simple Grid */
.trade-card-body {
    padding: var(--space-2);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-1) var(--space-2);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-muted);
}

.trade-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.trade-info-label {
    font-size: 8px;
    color: var(--fg-faint);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.trade-info-value {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--fg-default);
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trade-info-value.profit { color: var(--success); }
.trade-info-value.loss { color: var(--danger); }

/* P&L row - full width */
.trade-info.pnl-info {
    grid-column: span 3;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-1);
    margin-top: var(--space-1);
    border-top: 1px solid var(--border-muted);
}

.trade-info.pnl-info .trade-info-label {
    font-size: var(--text-xs);
}

.trade-info.pnl-info .trade-info-value {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
}

/* Active/Float highlight */
.trade-info.af-info .trade-info-value {
    color: var(--accent);
}

/* Trade Card Footer */
.trade-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-muted);
}

.trade-date {
    font-size: var(--text-xs);
    color: var(--fg-faint);
}

.trade-actions {
    display: flex;
    gap: var(--space-1);
}

.trade-btn {
    padding: 6px 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: all var(--duration);
    background: transparent;
    color: var(--fg-muted);
}

.trade-btn:hover {
    background: var(--bg-overlay);
}

.trade-btn.close-btn {
    background: var(--accent-subtle);
    color: var(--accent);
}

.trade-btn.close-btn:hover {
    background: var(--accent-muted);
}

.trade-btn.chart-btn:hover { color: var(--purple); }
.trade-btn.edit-btn:hover { color: var(--accent); }
.trade-btn.delete-btn:hover { color: var(--danger); }

/* ==================== SIMPLE VIEW ==================== */
.trade-card.simple-view {
    padding: 0;
}

.trade-card.simple-view .trade-card-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: none;
}

.trade-simple-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-sm);
    width: 100%;
}

.trade-card.simple-view .trade-pair-name {
    min-width: 70px;
}

.trade-card.simple-view .trade-lots-simple {
    color: var(--fg-faint);
    font-size: var(--text-xs);
}

.trade-pnl-simple {
    font-weight: var(--font-bold);
    font-variant-numeric: tabular-nums;
}

.trade-pnl-simple.profit {
    color: var(--success);
}

.trade-pnl-simple.loss {
    color: var(--danger);
}

.trade-actions-simple {
    display: flex;
    gap: var(--space-1);
    margin-left: auto;
}

.trade-btn-simple {
    background: transparent;
    border: none;
    color: var(--fg-faint);
    padding: var(--space-2);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.trade-btn-simple:hover {
    background: var(--bg-overlay);
}

.trade-btn-simple.close-btn:hover { color: var(--success); }
.trade-btn-simple.edit-btn:hover { color: var(--accent); }
.trade-btn-simple.delete-btn:hover { color: var(--danger); }
.trade-btn-simple.chart-btn:hover { color: var(--purple); }

/* ==================== PERFORMANCE SECTION ==================== */
.performance-section {
    padding: var(--space-3);
    border-top: 1px solid var(--border-default);
    background: var(--bg-base);
    flex-shrink: 0;
}

.performance-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: var(--space-1) 0;
    margin-bottom: var(--space-2);
}

.performance-header h2 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.performance-header h2 i {
    color: var(--accent);
}

.performance-header .toggle-icon {
    color: var(--fg-faint);
    font-size: var(--text-xs);
    transition: transform var(--duration) var(--ease-out);
}

.performance-header .toggle-icon.collapsed {
    transform: rotate(-90deg);
}

/* Performance Summary - Always Visible */
.performance-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.summary-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: var(--space-2);
    text-align: center;
    min-width: 0;
}

.summary-item.total {
    border-color: var(--accent);
}

.summary-label {
    font-size: 9px;
    color: var(--fg-faint);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: var(--font-semibold);
    margin-bottom: 2px;
}

.summary-value {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    font-variant-numeric: tabular-nums;
}

.summary-value.win {
    color: var(--success);
}

.summary-value.loss {
    color: var(--danger);
}

/* Performance Grid */
.performance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    max-height: 500px;
    transition: all var(--duration-slow) var(--ease-out);
}

.performance-grid.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
}

.perf-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
}

.perf-label {
    font-size: 10px;
    color: var(--fg-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: var(--font-semibold);
}

.perf-value {
    font-size: var(--text-base);
    font-weight: var(--font-bold);
    font-variant-numeric: tabular-nums;
    margin-top: var(--space-1);
}

.perf-value.win {
    color: var(--success);
}

.perf-value.loss {
    color: var(--danger);
}

.perf-bar {
    height: 4px;
    background: var(--border-default);
    border-radius: var(--radius-full);
    margin-top: var(--space-2);
    overflow: hidden;
}

.perf-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--duration-slower) var(--ease-out);
}

.perf-bar-fill.win {
    background: var(--gradient-success);
}

.perf-bar-fill.loss {
    background: var(--gradient-danger);
}

/* ==================== CALENDAR VIEW ==================== */
.calendar-view {
    padding: 0 var(--space-5) var(--space-5);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.cal-nav-btn {
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    color: var(--fg-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-nav-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.cal-month-year {
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: var(--space-2);
}

.calendar-weekdays span {
    text-align: center;
    font-size: 10px;
    color: var(--fg-faint);
    padding: var(--space-2) 0;
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day {
    aspect-ratio: 1;
    background: var(--bg-overlay);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    cursor: default;
    transition: all var(--duration) var(--ease-out);
}

.cal-day.empty {
    background: transparent;
    border-color: transparent;
}

.cal-day.today {
    border-color: var(--accent);
    border-width: 2px;
}

.cal-day.has-trades {
    cursor: pointer;
}

.cal-day.has-trades:hover {
    transform: scale(1.05);
}

.cal-day.has-win {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.cal-day.has-loss {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.cal-day .day-num {
    font-weight: var(--font-medium);
    color: var(--fg-muted);
}

.cal-day .day-pnl {
    font-size: 9px;
    font-weight: var(--font-bold);
}

.cal-day .day-pnl.win {
    color: var(--success);
}

.cal-day .day-pnl.loss {
    color: var(--danger);
}

.calendar-summary {
    display: flex;
    justify-content: space-around;
    margin-top: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-overlay);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
}

.cal-summary-item {
    text-align: center;
}

.cal-summary-label {
    font-size: 10px;
    color: var(--fg-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cal-summary-value {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
}

/* ==================== CHART SECTION ==================== */
.chart-section {
    background: var(--gradient-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    margin-top: var(--space-6);
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.section-header h2 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: -0.01em;
}

.section-header h2 i {
    color: var(--accent);
}

.chart-timeframe {
    display: flex;
    gap: 4px;
    background: var(--bg-overlay);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.tf-btn {
    padding: var(--space-2) var(--space-3);
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg-muted);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.tf-btn:hover {
    color: var(--fg-default);
}

.tf-btn.active {
    background: var(--bg-base);
    color: var(--fg-default);
    box-shadow: var(--shadow-sm);
}

.chart-container {
    height: 500px;
    background: var(--bg-base);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-default);
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-5);
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-elevated);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 480px;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn var(--duration-slow) var(--ease-out);
    overflow: visible;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-overlay);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    letter-spacing: -0.01em;
}

.modal-header h3 i {
    color: var(--accent);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.modal-close:hover {
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.modal-body {
    padding: var(--space-6);
    overflow: visible;
}

.modal-body textarea {
    width: 100%;
    padding: var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-base);
    color: var(--fg-default);
    font-size: var(--text-sm);
    font-family: var(--font-sans);
    resize: vertical;
    min-height: 100px;
    transition: all var(--duration) var(--ease-out);
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.trade-summary {
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.trade-summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--border-muted);
}

.trade-summary-row:last-child {
    border-bottom: none;
}

.trade-summary-row span:first-child {
    color: var(--fg-muted);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-6);
    border-top: 1px solid var(--border-default);
    background: var(--bg-overlay);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

/* Modal Button Variants */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
    border: none;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--bg-base);
    color: var(--fg-muted);
    border: 1px solid var(--border-emphasis);
}

.btn-secondary:hover {
    background: var(--bg-surface);
    color: var(--fg-default);
    border-color: var(--fg-subtle);
}

/* ==================== SETTINGS MODAL ==================== */
.settings-modal {
    max-width: 560px;
}

.settings-section {
    margin-bottom: var(--space-6);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--fg-default);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.settings-section h4 i {
    color: var(--accent);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-muted);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row label {
    color: var(--fg-muted);
    font-size: var(--text-sm);
}

.settings-row span {
    color: var(--fg-default);
    font-weight: var(--font-medium);
}

.settings-row input,
.settings-row select {
    width: 160px;
    height: 40px;
    padding: 0 var(--space-3);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    color: var(--fg-default);
    font-size: var(--text-sm);
    transition: all var(--duration) var(--ease-out);
}

.settings-row input:focus,
.settings-row select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.badge {
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-admin {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.badge-user {
    background: var(--accent-muted);
    color: var(--accent);
    border: 1px solid var(--accent);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
.toast-notification {
    position: fixed;
    top: var(--space-6);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--bg-elevated);
    color: var(--fg-default);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    z-index: 10001;
    opacity: 0;
    transition: transform var(--duration-slow) var(--ease-out), opacity var(--duration-slow) var(--ease-out);
    max-width: 90%;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border: 1px solid var(--border-default);
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification i {
    font-size: 1.25rem;
}

.toast-error {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), var(--bg-elevated));
}

.toast-error i {
    color: var(--danger);
}

.toast-warning {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), var(--bg-elevated));
}

.toast-warning i {
    color: var(--warning);
}

.toast-success {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), var(--bg-elevated));
}

.toast-success i {
    color: var(--success);
}

.toast-info {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-muted), var(--bg-elevated));
}

.toast-info i {
    color: var(--accent);
}

/* ==================== SAVING INDICATOR ==================== */
.saving-indicator {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    color: var(--fg-muted);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    animation: slideInUp var(--duration-slow) var(--ease-out);
}

.saving-indicator.saved {
    color: var(--success);
    border-color: var(--success);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== SL ALERT STYLES ==================== */
.trade-card.sl-warning {
    border-color: var(--warning) !important;
    animation: pulseWarning 2s infinite;
}

.trade-card.sl-warning::before {
    background: linear-gradient(180deg, var(--warning), var(--warning-light)) !important;
}

@keyframes pulseWarning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(245, 158, 11, 0);
    }
}

.sl-alert {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.1));
    border: 1px solid var(--warning);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin: var(--space-3) var(--space-4);
}

.sl-alert-content {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--warning);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
}

.sl-alert-content i {
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.sl-alert-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.sl-alert-btn {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.sl-alert-btn.update-sl {
    background: var(--warning);
    color: black;
}

.sl-alert-btn.close-trade {
    background: var(--danger);
    color: white;
}

.sl-alert-btn:hover {
    transform: translateY(-1px);
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-emphasis);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--fg-faint);
}

/* ==================== THEME TRANSITION ==================== */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color var(--duration-slow), border-color var(--duration-slow), color var(--duration-slow), box-shadow var(--duration-slow) !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
    .app-container {
        margin-right: 0;
    }

    .main-content {
        border-right: none;
    }

    .sidebar {
        transform: translateX(100%);
        z-index: 1000;
        width: 360px;
    }

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

    .sidebar.collapsed {
        transform: translateX(100%);
    }

    .main-content {
        padding-bottom: 100px;
    }
}

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

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

    .lots-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .top-bar {
        padding: var(--space-3) var(--space-4);
    }

    .main-content {
        padding: var(--space-4);
    }

    .sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: var(--space-3);
    }

    .input-section,
    .results-section {
        padding: var(--space-4);
    }

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

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

    .live-price-spread-row {
        grid-template-columns: 1fr;
    }

    .performance-summary {
        grid-template-columns: 1fr;
    }

    .trade-card-body {
        grid-template-columns: 1fr 1fr;
    }

    .trade-info.pnl-info {
        grid-column: span 2;
    }

    .sidebar {
        width: 100% !important;
    }
}

/* Sidebar specific responsive adjustments */
@media (max-width: 400px) {
    .trade-card-body {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-1);
    }

    .trade-info {
        padding: var(--space-1) var(--space-2);
    }

    .trade-info-label {
        font-size: 8px;
    }

    .trade-info-value {
        font-size: var(--text-xs);
    }

    .trade-info.pnl-info {
        grid-column: span 2;
    }
}

/* ==================== WALLET SYSTEM ==================== */

/* Wallet Selector */
.wallet-selector {
    position: relative;
    margin-bottom: var(--space-3);
}

.wallet-selector-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    color: var(--fg-default);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.wallet-selector-btn:hover {
    border-color: var(--border-emphasis);
    background: var(--bg-overlay);
}

.wallet-color {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.wallet-name {
    flex: 1;
    text-align: left;
    font-weight: var(--font-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wallet-shared-badge {
    font-size: 10px;
    color: var(--fg-muted);
}

.wallet-arrow {
    font-size: 10px;
    color: var(--fg-muted);
    transition: transform var(--duration) var(--ease-out);
}

.wallet-selector.open .wallet-arrow {
    transform: rotate(180deg);
}

/* Wallet Dropdown */
.wallet-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--space-1);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    max-height: 280px;
    overflow: hidden;
}

.wallet-selector.open .wallet-dropdown {
    display: block;
}

.wallet-dropdown-list {
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-1);
}

.wallet-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.wallet-dropdown-item:hover {
    background: var(--bg-overlay);
}

.wallet-dropdown-item.active {
    background: var(--accent-muted);
}

.wallet-dropdown-item .wallet-color {
    width: 10px;
    height: 10px;
}

.wallet-dropdown-item .wallet-name {
    font-size: var(--text-sm);
}

.wallet-dropdown-item .wallet-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.wallet-dropdown-item .wallet-trades {
    font-size: var(--text-xs);
    color: var(--fg-muted);
}

.wallet-dropdown-item .wallet-role {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: var(--bg-overlay);
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wallet-dropdown-item .wallet-role.owner {
    background: var(--accent-muted);
    color: var(--accent);
}

.wallet-dropdown-divider {
    height: 1px;
    background: var(--border-default);
    margin: var(--space-1) 0;
}

.wallet-dropdown-action {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    color: var(--fg-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.wallet-dropdown-action:hover {
    background: var(--bg-overlay);
    color: var(--fg-default);
}

.wallet-dropdown-action i {
    width: 14px;
    text-align: center;
}

/* Wallet Manager Modal */
.modal-lg {
    max-width: 640px;
}

.wallet-manager-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
    padding-bottom: var(--space-2);
}

.wallet-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--fg-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.wallet-tab:hover {
    background: var(--bg-overlay);
    color: var(--fg-default);
}

.wallet-tab.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.invitation-badge {
    padding: 2px 6px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: var(--font-bold);
    border-radius: var(--radius-full);
}

.wallet-tab-content {
    display: none;
}

.wallet-tab-content.active {
    display: block;
}

/* Wallet List in Manager */
.wallet-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.wallet-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
    transition: all var(--duration) var(--ease-out);
}

.wallet-list-item:hover {
    border-color: var(--border-emphasis);
}

.wallet-list-item .wallet-color {
    width: 16px;
    height: 16px;
}

.wallet-list-item .wallet-details {
    flex: 1;
    min-width: 0;
}

.wallet-list-item .wallet-name {
    font-weight: var(--font-medium);
    color: var(--fg-default);
    margin-bottom: 2px;
}

.wallet-list-item .wallet-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--fg-muted);
}

.wallet-list-item .wallet-actions {
    display: flex;
    gap: var(--space-1);
}

.wallet-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-overlay);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--fg-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.wallet-action-btn:hover {
    background: var(--bg-base);
    color: var(--fg-default);
    border-color: var(--border-emphasis);
}

.wallet-action-btn.danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Invitation List */
.invitation-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.invitation-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius);
}

.invitation-item .invitation-info {
    flex: 1;
}

.invitation-item .invitation-wallet {
    font-weight: var(--font-medium);
    color: var(--fg-default);
}

.invitation-item .invitation-meta {
    font-size: var(--text-xs);
    color: var(--fg-muted);
}

.invitation-item .invitation-actions {
    display: flex;
    gap: var(--space-2);
}

/* Create Wallet Modal */
.wallet-color-picker {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--duration) var(--ease-out);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--fg-default);
    box-shadow: 0 0 0 2px var(--bg-elevated);
}

/* Members Modal */
.invite-member-section {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.invite-member-section h4,
.members-list-section h4 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--fg-default);
    margin-bottom: var(--space-3);
}

.invite-form {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.invite-form input[type="email"] {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.invite-form input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.invite-form input[type="email"]::placeholder {
    color: var(--text-muted);
}

.invite-form select {
    width: 180px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.invite-form select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.invite-form button {
    white-space: nowrap;
    padding: var(--space-3) var(--space-4);
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
    min-width: 180px;
}

.custom-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select-trigger:hover {
    border-color: var(--border-hover);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.custom-select.open .custom-select-trigger i {
    transform: rotate(180deg);
}

.custom-select-trigger i {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.custom-select-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.custom-select.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: background 0.15s ease;
}

.custom-select-option:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.custom-select-option:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.custom-select-option:hover {
    background: var(--bg-hover);
}

.custom-select-option > i:first-child {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.custom-select-option .option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.custom-select-option .option-label {
    font-weight: 500;
    color: var(--text-primary);
}

.custom-select-option .option-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.custom-select-option .check-icon {
    opacity: 0;
    color: var(--accent);
    font-size: 0.85rem;
}

.custom-select-option.selected .check-icon {
    opacity: 1;
}

.custom-select-option.selected {
    background: rgba(59, 130, 246, 0.1);
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.member-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-base);
    border-radius: var(--radius);
}

.member-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: var(--font-medium);
    color: var(--fg-default);
}

.member-email {
    font-size: var(--text-xs);
    color: var(--fg-muted);
}

.member-role {
    padding: var(--space-1) var(--space-2);
    background: var(--bg-overlay);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--fg-muted);
    text-transform: capitalize;
}

.member-role.owner {
    background: var(--accent-muted);
    color: var(--accent);
}

.member-actions {
    display: flex;
    gap: var(--space-1);
}

/* Form Row */
.form-row {
    display: flex;
    gap: var(--space-3);
}

.form-row .form-group {
    flex: 1;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-6);
    color: var(--fg-muted);
}

.empty-state i {
    font-size: 32px;
    margin-bottom: var(--space-2);
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--text-sm);
}

/* ==================== MT SYNC STYLES ==================== */

/* MT Sync Section */
.mt-sync-section {
    border-top: 1px solid var(--border-default);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
}

.mt-sync-section .section-description {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    margin-bottom: var(--space-3);
}

.mt-sync-section .sync-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-sm);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.mt-sync-section .sync-status i {
    font-size: 8px;
}

.mt-sync-section .status-active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--fg-positive);
}

.mt-sync-section .status-inactive {
    background: rgba(148, 163, 184, 0.15);
    color: var(--fg-muted);
}

.mt-sync-section .token-container {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.mt-sync-section .token-display {
    background: var(--bg-raised);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: var(--text-sm);
    color: var(--fg-default);
}

.mt-sync-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.mt-download-section {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.mt-download-section h5 {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--fg-muted);
    margin-bottom: var(--space-2);
}

.download-buttons {
    display: flex;
    gap: var(--space-2);
}

/* Token Modal */
.token-modal .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    color: #f59e0b;
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.token-modal .alert-warning i {
    margin-top: 2px;
}

.token-display-full {
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.token-display-full code {
    flex: 1;
    font-family: monospace;
    font-size: var(--text-sm);
    color: var(--fg-default);
    word-break: break-all;
}

.token-display-full .btn-copy {
    flex-shrink: 0;
}

.token-instructions {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.token-instructions h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.token-instructions ol {
    margin-left: var(--space-4);
    font-size: var(--text-sm);
    color: var(--fg-muted);
}

.token-instructions li {
    margin-bottom: var(--space-1);
}

/* Setup Modal */
.setup-modal .setup-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.setup-step {
    display: flex;
    gap: var(--space-3);
}

.step-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.step-content p {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    margin-bottom: var(--space-2);
}

.step-content ol,
.step-content ul {
    font-size: var(--text-sm);
    color: var(--fg-muted);
    margin-left: var(--space-4);
}

.step-content li {
    margin-bottom: var(--space-1);
}

.url-display {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-2);
}

.url-display code {
    flex: 1;
    font-family: monospace;
    font-size: var(--text-xs);
    word-break: break-all;
}

/* Button variants for MT sync */
.btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--fg-positive);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--fg-default);
}

.btn-outline:hover {
    background: var(--bg-raised);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--text-xs);
}

.btn-copy {
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    color: var(--fg-muted);
    padding: 4px 8px;
    font-size: var(--text-xs);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.btn-copy:hover {
    background: var(--bg-overlay);
    color: var(--fg-default);
}
