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

:root {
    /* Theme - Dark (Default) */
    --primary: #6366f1;
    --primary-light: #a5b4fc;
    --primary-dark: #4338ca;
    --success: #10b981;
    --success-light: #6ee7b7;
    --danger: #f43f5e;
    --danger-light: #fda4af;
    --warning: #f59e0b;
    --warning-light: #fcd34d;
    --info: #0ea5e9;
    --bg-dark: #020617;
    --bg-card: rgba(15, 23, 42, 0.4);
    --bg-card-hover: rgba(15, 23, 42, 0.6);
    --bg-input: rgba(2, 6, 23, 0.6);
    --bg-elevated: rgba(15, 23, 42, 0.98);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.15);
    --glow-primary: rgba(99, 102, 241, 0.3);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --primary-rgb: 99, 102, 241;
}

/* Auth Mode Overlays */
body.auth-mode .header,
body.auth-mode .main-content,
body.auth-mode .fab,
body.auth-mode .modal-overlay {
    display: none !important;
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

body.auth-mode .auth-overlay {
    display: flex;
}

.auth-container {
    display: flex;
    width: 100%;
    height: 100vh;
    margin: 0;
    position: relative;
}

.auth-visual {
    flex: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 4rem;
    position: relative;
    overflow: hidden;
}

.brand-text {
    font-family: 'Outfit', sans-serif;
    font-size: 6.5rem;
    font-weight: 800;
    line-height: 0.9;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    letter-spacing: -0.04em;
    animation: slideRight 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.brand-text span {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
    display: inline-block;
    animation: bounce 2s infinite ease-in-out;
}

.brand-tagline {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 440px;
    line-height: 1.6;
    animation: fadeIn 1s ease-out 0.4s forwards;
    opacity: 0;
}

.brand-decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.decor-card {
    position: absolute;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 200px;
}

.decor-1 {
    top: 20%;
    left: 10%;
    animation: float 8s infinite ease-in-out;
}

.decor-2 {
    bottom: 20%;
    right: 10%;
    animation: float 10s infinite ease-in-out reverse;
}

.decor-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
}

.decor-line {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    flex: 1;
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(15px, -25px);
    }
}

/* Financial HUD Animation */
.financial-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    opacity: 0.85;
}

.hud-chart {
    position: absolute;
    bottom: -15%;
    left: -5%;
    width: 120%;
    height: 70%;
    opacity: 0.4;
    animation: slideUpFade 2s ease-out;
}

.hud-chart .grid-lines line {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 0.5;
    stroke-dasharray: 4 4;
}

.chart-line {
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 4s ease-in-out forwards;
    filter: drop-shadow(0 0 10px var(--success-light));
}

.chart-area {
    opacity: 0;
    animation: fadeInArea 2s ease-in-out 1.2s forwards;
}

/* Candlesticks */
.bull-path,
.bear-path {
    stroke-width: 1;
    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.bull-body,
.bear-body {
    opacity: 0;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.bull-path {
    stroke: var(--success);
}

.bull-body {
    fill: var(--success);
}

.bear-path {
    stroke: var(--danger);
}

.bear-body {
    fill: var(--danger);
}

.auth-candlesticks line:nth-child(1),
.auth-candlesticks rect:nth-child(2) {
    animation-delay: 0.8s;
}

.auth-candlesticks line:nth-child(3),
.auth-candlesticks rect:nth-child(4) {
    animation-delay: 1.1s;
}

.auth-candlesticks line:nth-child(5),
.auth-candlesticks rect:nth-child(6) {
    animation-delay: 1.4s;
}

.auth-candlesticks line:nth-child(7),
.auth-candlesticks rect:nth-child(8) {
    animation-delay: 1.7s;
}

.hud-badges {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.badge-float {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
}

.badge-float.b1 {
    top: 15%;
    left: 10%;
    animation: badgeFloat 6s ease-in-out infinite alternate, badgePopIn 0.8s ease-out 1.5s forwards;
    border-color: rgba(99, 102, 241, 0.2);
}

.badge-float.b2 {
    top: 60%;
    right: 5%;
    animation: badgeFloat 7s ease-in-out infinite alternate-reverse, badgePopIn 0.8s ease-out 2s forwards;
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-light);
}

.badge-float.b3 {
    bottom: 20%;
    left: 15%;
    animation: badgeFloat 8s ease-in-out infinite alternate, badgePopIn 0.8s ease-out 2.5s forwards;
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning-light);
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeInArea {
    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(15px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes badgePopIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(15px);
    }

    to {
        opacity: 0.55;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 0.45;
        transform: translateY(0);
    }
}

@keyframes badgeFloat {
    from {
        transform: translateY(0) rotate(0deg);
    }

    to {
        transform: translateY(-12px) rotate(1.5deg);
    }
}

@media (max-width: 1024px) {
    .badge-float {
        font-size: 0.75rem;
        padding: 0.5rem 0.8rem;
    }

    .hud-chart {
        bottom: -5%;
        opacity: 0.25;
    }
}






.auth-right {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 2rem;
    border-left: 1px solid var(--border);
    min-height: 100vh;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.25rem;
}

.auth-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.auth-tabs-container {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2.25rem;
}

.auth-tab-wrapper {
    flex: 1;
}

.auth-tab-block {
    width: 100%;
    padding: 1rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--primary-light);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-card.expanded .auth-tab-block {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border-light);
    font-weight: 600;
}

.auth-tab-block:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.auth-tab-block.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
    box-shadow: 0 8px 25px var(--glow-primary) !important;
    font-weight: 700 !important;
    transform: translateY(-1px);
}

.forms-wrapper {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-card.expanded .forms-wrapper {
    max-height: 1200px;
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    opacity: 0;
    padding: 1rem 0.25rem 0;
}

.auth-form.active {
    display: flex;
    animation: fadeInSlideUp 0.5s ease-out forwards;
}

@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    display: none;
    /* Hidden by default */
}

.auth-card.expanded .auth-footer {
    display: block;
    animation: fadeIn 0.4s ease-out 0.2s forwards;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.auth-footer a:hover {
    text-decoration: underline;
    color: var(--primary-light);
}

/* Registration Layout Fixes */
.registration-top-row {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.profile-emoji-picker {
    width: 90px;
    height: 90px;
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.profile-emoji-picker:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.edit-profile-icon {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-emoji-picker:hover .edit-profile-icon {
    opacity: 1;
}

.name-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-full {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    .registration-top-row {
        flex-direction: column;
    }

    .profile-emoji-picker {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .name-fields {
        width: 100%;
    }
}

/* Inline Errors & Validation */
.inline-error {
    color: var(--danger);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
    display: none;
}

.inline-error.active {
    display: block;
    animation: shake 0.3s ease-in-out;
}

.inline-error.general {
    text-align: center;
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(244, 63, 94, 0.1);
    border-radius: var(--radius-sm);
}

.field-error {
    border-color: var(--danger) !important;
    animation: shake 0.4s ease-in-out;
    box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.1);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-5px);
    }

    30% {
        transform: translateX(5px);
    }

    45% {
        transform: translateX(-4px);
    }

    60% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-2px);
    }
}

/* Autofill Reset - Premium Version */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text-primary) !important;
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    transition: background-color 5000s ease-in-out 0s;
    background-color: var(--bg-input) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 0.9rem !important;
}

/* Fix for Firefox/Other Autocomplete */
input:autofill {
    background-color: var(--bg-input) !important;
    font-family: 'Inter', sans-serif !important;
}

/* Circular Profile UI (Register) */
.registration-top-row {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
    position: relative;
    z-index: 1000;
}

.reg-profile-section {
    position: relative;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    z-index: 2000;
}

.reg-names-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
}

.reg-profile-pic {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.reg-profile-pic:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.reg-profile-pic .edit-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.2s;
}

.reg-profile-pic:hover .edit-overlay {
    opacity: 1;
}

.reg-profile-pic .edit-overlay::after {
    content: '✎';
    font-size: 1.2rem;
    color: white;
}

.emoji-popover {
    position: absolute;
    left: calc(100% + 15px);
    top: 10px;
    width: 250px;
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    padding: 12px 18px 12px 12px;
    display: none;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    animation: fadeInSide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.emoji-popover::-webkit-scrollbar {
    width: 6px;
}

.emoji-popover::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-popover::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 10px;
    border: 2px solid var(--bg-elevated);
}

.emoji-popover::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.emoji-popover::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 40px;
    width: 12px;
    height: 12px;
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    transform: rotate(45deg);
    z-index: 101;
}

.emoji-popover.active {
    display: grid;
}

.emoji-popover .emoji-item {
    cursor: pointer;
    padding: 5px;
    font-size: 1.35rem;
    text-align: center;
    border-radius: 6px;
    transition: 0.2s;
}

.emoji-popover .emoji-item:hover {
    background: var(--border);
    transform: scale(1.2);
}

@keyframes fadeInSide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .registration-top-row {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .reg-names-column {
        width: 100%;
        align-items: stretch !important;
        text-align: left !important;
    }

    .reg-names-column .form-group {
        width: 100%;
    }

    .reg-names-column .form-group label {
        text-align: left !important;
        width: 100% !important;
        padding-left: 2px;
    }

    .emoji-popover {
        left: 50%;
        transform: translateX(-50%);
        top: calc(100% + 15px);
        width: calc(100vw - 60px);
        max-width: 300px;
        animation: fadeIn 0.3s ease-out;
    }

    .emoji-popover::before {
        top: -6px;
        left: 50%;
        width: 12px;
        height: 12px;
        transform: translateX(-50%) rotate(45deg);
        border-left: 1px solid var(--border-light);
        border-top: 1px solid var(--border-light);
        border-bottom: none;
        border-right: none;
    }
}

@keyframes shake-form {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-8px);
    }

    80% {
        transform: translateX(8px);
    }
}

.shake-form {
    animation: shake-form 0.4s ease-in-out;
}

/* User Profile Trigger & Popover */
.user-profile-trigger {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile-trigger:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 4px 15px var(--glow-primary);
}

.profile-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 5000;
    overflow: hidden;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: popoverFadeIn 0.2s ease-out;
}

.profile-popover.active {
    display: flex;
}

@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popover-header {
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.popover-header span {
    font-size: 2.8rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border-radius: 50%;
    border: 1px solid var(--border);
}

.popover-user-info div:first-child {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.popover-user-info div:last-child {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.popover-menu {
    padding: 0.5rem;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.popover-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.popover-item.logout:hover {
    color: #fe5f57;
    background: rgba(254, 95, 87, 0.05);
}

.popover-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0.85rem;
}

[data-theme='light'] {
    --bg-dark: #f5f7fa;
    --bg-card: #f8f9fa;
    --bg-card-hover: #e9ecef;
    --bg-input: #f8f9fa;
    --bg-elevated: #f8f9fa;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border: #e2e8f0;
    --border-light: #cbd5e1;
    --glow-primary: rgba(99, 102, 241, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

[data-theme='light'] body::before {
    content: none;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Header */
/* Header Layout */
.header {
    background: var(--bg-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.65rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 4000;
    height: 70px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

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

.header-center h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
}

.sidebar-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: 0.2s;
}

.sidebar-toggle:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
    color: var(--primary);
}

.sidebar-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--glow-primary);
}

.header-brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    background: linear-gradient(135deg, var(--success), var(--success-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 70px;
    left: -280px;
    width: 280px;
    height: calc(100vh - 70px);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    z-index: 3000;
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 70px;
    inset-inline: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
    z-index: 2999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

.sidebar-brand span {
    color: var(--text-primary);
}

.sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-group {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.sidebar-group:first-child {
    border-top: none;
    padding-top: 0;
}

.sidebar-group-toggle {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 0.5rem 0;
    padding-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.sidebar-group-toggle:hover {
    color: var(--text-secondary);
}

.sidebar-group-toggle .toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-group.expanded .toggle-icon {
    transform: rotate(0deg);
}

.sidebar-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.sidebar-group-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-group.collapsed .sidebar-group-content {
    max-height: 0;
}

.sidebar-nav .nav-tab {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.sidebar-nav .nav-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-nav .nav-tab.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav .nav-tab svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

/* Portfolio Section Styles */
.portfolio-section {
    margin: 0.5rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.portfolio-header {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    justify-content: space-between;
    position: relative;
    min-height: 32px;
}

.portfolio-header:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.portfolio-header.active {
    background: var(--primary);
    color: white;
}

.portfolio-header .expand-icon {
    width: 12px;
    height: 12px;
    opacity: 0.7;
    transition: transform 0.2s;
}

.portfolio-header.expanded .expand-icon {
    transform: rotate(180deg);
}



.portfolio-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    margin-left: 1.5rem;
}

.portfolio-submenu.expanded {
    max-height: 500px;
    /* Adjust based on content */
}

.portfolio-submenu .nav-tab {
    margin: 0.1rem 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.portfolio-submenu .nav-tab .portfolio-item-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.portfolio-submenu .nav-tab:hover .portfolio-item-actions {
    opacity: 1;
}

.portfolio-submenu .nav-tab .item-action-btn {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.portfolio-submenu .nav-tab .item-action-btn:hover {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.portfolio-submenu .nav-tab .item-action-btn.edit:hover {
    color: var(--primary);
}

.portfolio-submenu .nav-tab .item-action-btn.delete:hover {
    color: var(--danger);
}

/* ==================== CONFIGURATION PAGE — PREMIUM REDESIGN ==================== */

/* Tab Navigation */
.config-tabs {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 5px;
}

.config-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    white-space: nowrap;
}

.config-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.config-tab.active {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    font-weight: 600;
}

.config-tab svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.config-tab-content {
    min-height: 400px;
}

.config-tab-pane {
    display: none;
    animation: cfgFadeUp 0.3s ease-out;
    padding-top: 1rem;
}

.config-tab-pane.active {
    display: block;
}

@keyframes cfgFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Overview Tab */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.overview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.overview-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
    pointer-events: none;
}

.overview-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.12);
    transform: translateY(-3px);
}

.overview-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.overview-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.overview-icon.success {
    background: linear-gradient(135deg, var(--success), #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.overview-icon.warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.overview-icon.discipline {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.overview-icon.secondary {
    background: linear-gradient(135deg, #64748b, #334155);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

.overview-icon svg {
    width: 22px;
    height: 22px;
}

.overview-content {
    flex: 1;
}

.overview-content h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.overview-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.overview-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.overview-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.overview-stat-badge span {
    color: var(--primary);
    font-weight: 700;
}

/* Portfolios Tab */
.portfolio-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.portfolio-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.portfolio-badge {
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.default-badge {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.default-badge svg {
    color: #f59e0b;
}

.portfolios-content {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.portfolios-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.portfolio-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.2s;
    position: relative;
}

.portfolio-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.portfolio-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.portfolio-card-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.portfolio-card-icon svg {
    width: 20px;
    height: 20px;
}

.portfolio-card-content h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.portfolio-card-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.portfolio-card-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.portfolio-card:hover .portfolio-card-actions {
    opacity: 1;
}

.add-portfolio-card {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.add-portfolio-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary);
}

.add-portfolio-card svg {
    width: 32px;
    height: 32px;
}

.add-portfolio-card span {
    font-weight: 500;
}

/* Settings Tab */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.settings-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-icon {
    width: 40px;
    height: 40px;
    background: var(--success);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.settings-icon svg {
    width: 20px;
    height: 20px;
}

.settings-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-card-header p {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-card-content {
    padding: 1.5rem;
}

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

.default-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.default-item label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.rules-list {
    margin-bottom: 1.5rem;
}

.rule-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

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

.rule-info .rule-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.rule-info .rule-details {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.rule-values {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.add-rule-form .form-row {
    display: flex;
    gap: 1rem;
    align-items: end;
}

/* Lists Tab */
.lists-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.list-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.list-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.list-icon {
    width: 40px;
    height: 40px;
    background: var(--warning);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.list-card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.list-card-header p {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.list-count {
    background: var(--bg-input);
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.list-card-content {
    padding: 1.5rem;
}

.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

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

.settings-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-description {
    margin: 0 0 1rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.overall-defaults-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}

.overall-defaults-form .form-group {
    flex: 1;
}

.add-setting-form h5 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-form-grid .form-row {
    display: flex;
    gap: 1rem;
}

.setting-form-grid .form-group {
    flex: 1;
}

.setting-form-grid .form-group.full-width {
    flex: 1 1 100%;
}

.input-with-addon {
    position: relative;
}

.input-with-addon input {
    padding-right: 2.5rem;
    width: 100%;
}

.input-addon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    pointer-events: none;
}

.default-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.setting-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.setting-info span {
    font-size: 0.85rem;
    font-weight: 500;
}

.setting-market {
    color: var(--primary);
}

.setting-portfolio {
    color: var(--success);
}

.setting-type {
    color: var(--text-secondary);
    font-weight: 400;
}

.setting-values {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.setting-values span {
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-input);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* Portfolio Page Styles */
.portfolio-page {
    padding: 2rem;
}

.portfolio-header-section {
    margin-bottom: 2rem;
}

.portfolio-header-section h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.portfolio-header-section p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.portfolio-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.portfolio-list {
    margin-top: 2rem;
}

.no-portfolios {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-portfolios svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-portfolios p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}


.nav-tab {
    padding: 0.4rem 1.25rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

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

.nav-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--glow-primary);
}

.theme-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    border-color: var(--primary);
    transform: rotate(15deg);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.error {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

/* Main Content */
.main-content {
    padding: 1rem 2%;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.tab-content:not(.active) {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Titles */
.dashboard-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin: 2rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dashboard-section-title:first-of-type {
    margin-top: 0.5rem;
}

.dashboard-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-lg);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stat-card .label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.25rem 0;
    color: var(--text-primary);
}

.stat-card .change {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-card.accent-primary {
    border-top: 3px solid var(--primary);
}

.stat-card.accent-success {
    border-top: 3px solid var(--success);
}

.stat-card.accent-danger {
    border-top: 3px solid var(--danger);
}

.stat-card.accent-warning {
    border-top: 3px solid var(--warning);
}

.stat-card.accent-info {
    border-top: 3px solid var(--info);
}

/* Profile Settings Page */
.profile-settings-page {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 3rem;
    border: 1px solid var(--border);
    max-width: 1000px;
    margin: 0 auto;
    box-shadow: var(--shadow-lg);
}

.profile-settings-header {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 3rem;
}

.big-profile-pic {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 4px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    cursor: pointer;
    position: relative;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.big-profile-pic:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--glow-primary);
}

.big-profile-pic::after {
    content: 'Change Avatar';
    position: absolute;
    bottom: -35px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0;
    transition: 0.3s;
    font-weight: 600;
}

.big-profile-pic:hover::after {
    opacity: 1;
}

.profile-info h1 {
    font-size: 2.25rem;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.profile-info .username {
    font-size: 1.15rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.profile-info .email {
    font-size: 1rem;
    color: var(--text-secondary);
}

.profile-tabs {
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.profile-tab {
    padding: 0.85rem 0.25rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.profile-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.profile-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.readonly-input {
    background: var(--bg-input-hover) !important;
    opacity: 0.7;
    cursor: not-allowed !important;
}

.change-password-form {
    max-width: 450px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s ease-out;
}

.stat-progress-fill.primary {
    background: var(--primary);
}

.stat-progress-fill.success {
    background: var(--success);
}

.stat-progress-fill.danger {
    background: var(--danger);
}

.stat-progress-fill.warning {
    background: var(--warning);
}

.stat-progress-fill.info {
    background: var(--info);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.chart-card-wide {
    grid-column: 1 / -1;
}

.chart-card-header {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.chart-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
}

.chart-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    display: block;
}

.chart-container {
    min-height: 240px;
    width: 100%;
    position: relative;
}

/* SVG Chart Specifics */
.chart-dot {
    cursor: pointer;
    transition: r 0.2s;
}

.chart-dot:hover {
    r: 6;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th {
    background: rgba(0, 0, 0, 0.02);
    padding: 0.85rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th[onclick] {
    cursor: pointer;
    user-select: none;
}

th[onclick]:hover {
    background: rgba(0, 0, 0, 0.05);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.pagination button:hover {
    background: var(--bg-card-hover);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

td {
    padding: 0.85rem 1.25rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tr:hover td {
    background: rgba(0, 0, 0, 0.03);
}

/* All Trades Filter Bar */
.table-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.table-filters input,
.table-filters select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    justify-content: center;
    padding: 3rem 1.5rem;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.btn-save {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.btn-save:hover {
    background: var(--success) !important;
    color: white !important;
    transform: translateY(-2px);
}

.btn-save.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-close:hover {
    background: var(--danger) !important;
    color: white !important;
    transform: translateY(-2px);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(99, 102, 241, 0.03) 100%);
    position: relative;
    transition: all 0.3s ease;
}

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

.btn-swap-mode {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-swap-mode:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.btn-swap-mode:hover svg {
    transform: rotate(180deg);
}

.btn-swap-mode svg {
    transition: transform 0.4s ease;
}

/* Investment Mode Accents */
.modal-overlay.investment-mode .modal-header {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(16, 185, 129, 0.03) 100%);
}

.modal-overlay.investment-mode .modal-header::before {
    background: linear-gradient(to right, #10b981, #34d399);
}

.modal-overlay.investment-mode .btn-swap-mode {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.modal-overlay.investment-mode .modal-header-icon {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    position: relative;
}

.modal-header-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    z-index: -1;
    opacity: 0.5;
}

/* Trade Modal Split Layout */
.modal.trade-modal-split {
    max-width: 1100px;
    width: 95%;
    display: flex;
    flex-direction: row;
    padding: 0 !important;
    overflow: hidden;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

.modal-left {
    flex: 1.4;
    padding: 0;
    overflow-y: auto;
    max-height: 85vh;
    border-right: 1px solid var(--border);
}

.modal-left .modal-inner-padding {
    padding: 1.5rem 1.75rem;
}

.modal-right {
    flex: 1;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, rgba(2, 6, 23, 0.4) 100%);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.hud-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.hud-panel:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.hud-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hud-stat-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.hud-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.hud-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    line-height: 1;
}

.hud-stat-value small {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.2rem;
}

.hud-stat-value.success {
    color: var(--success);
}

.hud-stat-value.danger {
    color: var(--danger);
}

.hud-stat-value.warning {
    color: var(--warning);
}

.rule-match-badge {
    padding: 0.5rem 0.85rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 600;
}

.rule-match-badge svg {
    color: var(--primary);
}

.rule-match-badge.no-match {
    background: rgba(100, 116, 139, 0.1);
    border: 1px solid rgba(100, 116, 139, 0.2);
    color: var(--text-secondary);
}

.rule-match-badge.no-match svg {
    color: var(--text-muted);
}

.charge-breakdown-hud {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.charge-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.charge-item-row span:last-child {
    font-family: 'Inter', monospace;
    color: var(--text-primary);
    font-weight: 500;
}

.total-charge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.total-charge-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.total-charge-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--warning-light);
}

@media (max-width: 992px) {
    .modal.trade-modal-split {
        flex-direction: column;
        max-height: 90vh;
    }

    .modal-left {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    padding: 0;
    border: none;
    background: none;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.modal-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 450;
    line-height: 1.4;
}

.modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    background: var(--bg-main);
}

.modal-sections-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
}

.modal-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s ease;
}

.modal-section:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.modal-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border-light);
}

.modal-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-section-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

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

.modal-section-content {
    padding: 1.25rem;
}

.modal-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.select-all-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.select-all-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.checkbox-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.checkbox-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.checkbox-card input[type="checkbox"],
.checkbox-card input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-card span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.checkbox-card input:checked+span {
    color: var(--text-primary);
}

.checkbox-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 1px var(--primary);
}

.form-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}



.settings-row {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.half {
    flex: 1;
}

.input-with-icon {
    display: flex;
    align-items: stretch;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition);
}

.input-with-icon:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.input-with-icon-left {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid var(--border);
    color: var(--text-muted);
}

.input-with-icon input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    padding: 0.75rem 1rem !important;
    width: 100%;
    margin-left: 0 !important;
    box-shadow: none !important;
}

.input-with-icon.field-error {
    border-color: var(--danger) !important;
}

.input-with-icon svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    flex-shrink: 0;
}

.modal-close-btn:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border-color: rgba(244, 63, 94, 0.2);
    transform: rotate(90deg);
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(25px) saturate(180%);
    display: flex;
    flex-direction: column;
}

.modal form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    flex: 1;
}

.modal-header {
    flex-shrink: 0;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.02);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.modal-footer {
    flex-shrink: 0;
    margin-top: auto;
    background: rgba(0, 0, 0, 0.15);
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-light);
}

.modal-overlay.active .modal {
    transform: scale(1);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2), 0 12px 40px rgba(0, 0, 0, 0.12);
}

.modal h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

/* REDESIGNED TRADING RULE MODAL BODY */
.modal-rule-redesign {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 0.5rem;
}

.form-config-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.form-config-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(var(--primary-rgb), 0.15);
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.form-config-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.3), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.form-config-card:hover::before {
    opacity: 1;
}

.form-config-card:focus-within {
    border-color: rgba(var(--primary-rgb), 0.3);
    background: rgba(var(--primary-rgb), 0.04);
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.card-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-title-row span {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

/* Premium Input Styles */
.premium-input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.premium-input-wrapper input:focus {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.15);
}

.form-input-info {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.error-text {
    color: var(--danger);
    font-weight: 500;
}

.counter-text {
    color: var(--text-muted);
    margin-left: auto;
}

/* SCOPE GROUPS */
.config-scope-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.config-scope-group .form-group {
    margin: 0;
}

.config-scope-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.secondary-logic-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* CONSOLE BOX REDESIGN - PREMIUM MODULE HUB */
.console-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.console-features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Gap between spaced modules */
    padding: 1rem;
    /* Padding inside the box so cards don't touch edges */
}

.feature-row {
    display: flex;
    width: 100%;
    background: var(--bg-card);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.feature-row.active {
    overflow: visible;
    /* Ensure content isn't clipped when expanded */
}

.feature-row.charges-row {
    flex-direction: column;
}

.feature-card {
    flex: 1;
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
    border: none;
    background: transparent;
}

.feature-card:hover {
    background: rgba(var(--primary-rgb), 0.04);
}

.feature-card.active {
    background: rgba(var(--primary-rgb), 0.06);
}

.feature-row:not(.charges-row) .feature-card.active {
    flex: 0 0 50%;
    /* Take half width when active (for leverage) */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.charges-row .feature-card.active {
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
}

/* Inline Config Box - Vertical Layout */
.feature-inline-config {
    flex: 1;
    background: rgba(var(--primary-rgb), 0.1);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.inline-config-vertical {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.inline-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.inline-config-header label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
}

.inline-config-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem 1rem;
}

.inline-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inline-input-group input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--primary);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    width: 110px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s;
    line-height: 1;
}

.inline-input-group input:focus {
    outline: none;
    border-bottom-color: var(--primary-light);
    transform: scale(1.05);
    text-shadow: 0 0 20px rgba(var(--primary-rgb), 0.3);
}

.inline-input-group span {
    font-size: 0.7rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}

.inline-close-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.inline-close-btn:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--danger);
    border-color: var(--danger);
    transform: rotate(90deg);
}

.feature-card::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0;
    background: var(--primary);
    transform: translateY(-50%);
    transition: height 0.3s ease;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary);
}

.feature-card.active::after {
    height: 60%;
}

.feature-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.feature-card:hover .feature-icon-wrapper {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    transform: scale(1.05);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.feature-card.active .feature-icon-wrapper {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 5px 15px rgba(var(--primary-rgb), 0.4);
    border-color: var(--primary);
}

.feature-content {
    flex: 1;
}

.feature-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feature-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.feature-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    transition: all 0.3s;
}

.feature-card.active .feature-status-indicator {
    color: var(--primary);
}

.feature-card#btnAddLeverage.active .feature-status-indicator {
    display: none;
    /* Hide status text/tick for leverage when added */
}

.status-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.feature-card.active .status-check,
.feature-card.has-rules .status-check,
.feature-card.has-data .status-check {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.feature-card.has-rules .status-check.blue-tick {
    background: #3b82f6;
    /* Blue tick */
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* CONSOLE DETAILS & PANES */
.detail-pane {
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pane-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pane-header span {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.pane-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-add-charge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.2);
}

.btn-add-charge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.btn-add-charge svg {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
}

.pane-close {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.pane-close:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--danger);
    border-color: rgba(244, 63, 94, 0.2);
    transform: rotate(90deg);
}

.leverage-input-suite {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.leverage-input-suite::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: 0;
}

.leverage-input-suite input {
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--primary);
    font-size: 4rem;
    font-weight: 900;
    color: var(--text-primary);
    width: 200px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    position: relative;
    z-index: 1;
    transition: all 0.3s;
    text-shadow: 0 0 20px rgba(var(--primary-rgb), 0.3);
}

.leverage-input-suite input:focus {
    outline: none;
    border-bottom-color: var(--primary-light);
    transform: scale(1.05);
    text-shadow: 0 0 30px rgba(var(--primary-rgb), 0.5);
}

.leverage-unit {
    font-size: 0.8rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
}

.btn-glow {
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    color: var(--primary-light);
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-glow:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.4);
    transform: translateY(-1px);
}

/* CHARGE ROWS STACK */
.charge-rows-stack {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: radial-gradient(circle at center top, rgba(255, 255, 255, 0.01), transparent);
    box-shadow: inset 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.charge-row {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
}

.charge-row:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--primary-rgb), 0.3);
    box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(var(--primary-rgb), 0.1);
}

.charge-section-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    padding-left: 0.75rem;
}

.charge-section-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 12px;
    background: var(--primary);
    border-radius: 2px;
}

.charge-section-label span {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.75em;
}

.charge-card-sidebar {
    width: 6px;
    background: var(--primary);
    opacity: 0.6;
    transition: opacity 0.3s;
}

.charge-row:hover .charge-card-sidebar {
    opacity: 1;
}

.charge-card-main {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.charge-card-section {
    position: relative;
}

.charge-card-inputs-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logic-connector {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: lowercase;
    opacity: 0.5;
    font-style: italic;
}

.charge-nucleus {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.charge-nucleus-top {
    margin-bottom: 1.25rem;
}

.charge-nucleus-top select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    font-size: 0.9rem !important;
    letter-spacing: 0.5px;
}

.charge-card-main select {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.1rem;
}

.charge-card-main select:hover {
    border-color: rgba(var(--primary-rgb), 0.4);
    background: rgba(var(--primary-rgb), 0.05);
}

.btn-remove-charge {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.1);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.btn-remove-charge:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
}

/* Charge Row Collapsibility */
.charge-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.charge-row-header:hover {
    background: rgba(var(--primary-rgb), 0.08);
}

.charge-row-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-cat {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-light);
    letter-spacing: 0.5px;
}

.summary-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.charge-row-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.charge-row-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.charge-row:not(.collapsed) .charge-row-toggle {
    transform: rotate(180deg);
    color: var(--primary);
}

.charge-row-body {
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 2000px;
    /* Large expansion height */
    opacity: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

.charge-row.collapsed .charge-row-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.charge-row.collapsed {
    border-color: rgba(255, 255, 255, 0.05);
}

.charge-row.collapsed .charge-row-header {
    border-bottom-color: transparent;
}


.formula-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    margin: 0.5rem -1.5rem -1.5rem -1.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.formula-field-group label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.6rem;
}

.input-with-addon {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
}

.input-with-addon:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.2);
    background: rgba(var(--primary-rgb), 0.03);
}

.input-with-addon input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
}

.input-addon {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    color: var(--primary-light);
    font-size: 0.8rem;
    font-weight: 900;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

form {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(99, 102, 241, 0.03) 100%);
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    position: relative;
}

.modal-header-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    z-index: -1;
    opacity: 0.5;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    padding: 0;
    border: none;
    background: none;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.2rem 0 0 0;
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.select-all-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.select-all-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.segment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.segment-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.segment-card:hover {
    transform: translateY(-2px);
}

.segment-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment-card-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--bg-input) 0%, rgba(255, 255, 255, 0.05) 100%);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.segment-card-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.segment-card:hover .segment-card-content::before {
    left: 100%;
}

.segment-card-content svg {
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 20px;
    height: 20px;
}

.segment-card input[type="checkbox"]:checked+.segment-card-content {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.segment-card input[type="checkbox"]:checked+.segment-card-content svg {
    color: var(--primary);
    transform: scale(1.1);
}

.segment-card:hover .segment-card-content {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, rgba(255, 255, 255, 0.08) 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.segment-empty-msg {
    grid-column: 1/-1;
    text-align: center;
    padding: 1.25rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.segment-empty-msg a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.modal-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 450;
    line-height: 1.4;
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.select-all-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.select-all-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}

.segment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.segment-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.segment-card:hover {
    transform: translateY(-2px);
}

.segment-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment-card-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--bg-input) 0%, rgba(255, 255, 255, 0.05) 100%);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.segment-card-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.segment-card:hover .segment-card-content::before {
    left: 100%;
}

.segment-card-content svg {
    flex-shrink: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 20px;
    height: 20px;
}

.segment-card input[type="checkbox"]:checked+.segment-card-content {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0.08) 100%);
    color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

.segment-card input[type="checkbox"]:checked+.segment-card-content svg {
    color: var(--primary);
    transform: scale(1.1);
}

.segment-card:hover .segment-card-content {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, rgba(255, 255, 255, 0.08) 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.segment-empty-msg {
    grid-column: 1/-1;
    text-align: center;
    padding: 1.25rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.segment-empty-msg a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.form-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
}

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

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: linear-gradient(135deg, var(--bg-input) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--bg-card-hover) 0%, rgba(255, 255, 255, 0.05) 100%);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.form-section-title {
    grid-column: 1 / -1;
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    margin-top: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
    letter-spacing: 0.05em;
}

.form-actions,
.modal-footer {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.input-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.5rem;
}

.char-counter {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.modal-body {
    padding: 2rem 1.75rem;
}

.modal-body .form-group {
    margin-bottom: 2rem;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    gap: 0.5rem;
}

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

.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-primary.loading::before {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: white;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Security Content Styles */
.security-content {
    padding: 2rem 0;
}

/* Password Section Styles */
.password-section {
    max-width: 600px;
}

.password-status-line {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: var(--transition);
    overflow: hidden;
}

.password-status-line:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.password-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
}

.password-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.password-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.password-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.enabled {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.password-change-form {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.password-step {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.password-change-form h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.5rem 0;
}

/* Avatar Modal Styles */
.avatar-modal {
    max-width: 500px;
    width: 90vw;
}

.emoji-grid-container {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 0.75rem;
    font-size: 1.5rem;
    text-align: center;
    cursor: pointer;
    min-height: fit-content;
}

.emoji-opt {
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    aspect-ratio: 1;
}

.emoji-opt:hover {
    background: var(--bg-card-hover);
    transform: scale(1.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .avatar-modal {
        max-width: 95vw;
        width: 95vw;
        margin: 1rem;
    }

    .emoji-grid-container {
        max-height: 50vh;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
        gap: 0.5rem;
        font-size: 1.25rem;
    }

    .emoji-opt {
        min-height: 40px;
        padding: 0.375rem;
    }

    .segment-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .segment-card-content {
        padding: 0.7rem 0.8rem;
        font-size: 0.8rem;
    }

    .modal-header {
        padding: 1.25rem 1.25rem;
    }

    .modal {
        max-width: 95vw;
        margin: 1rem;
    }

    .modal-body {
        padding: 1.75rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .avatar-modal {
        max-width: 98vw;
        width: 98vw;
        margin: 0.5rem;
    }

    .emoji-grid-container {
        max-height: 40vh;
        padding: 0.75rem;
    }

    .emoji-grid {
        grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
        gap: 0.375rem;
        font-size: 1.1rem;
    }

    .emoji-opt {
        min-height: 35px;
        padding: 0.25rem;
    }

    .segment-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .segment-card-content {
        padding: 0.6rem 0.7rem;
        font-size: 0.75rem;
    }

    .modal-header {
        padding: 1rem 1rem;
    }

    .modal {
        max-width: 98vw;
        margin: 0.5rem;
        max-height: 95vh;
    }

    .input-footer {
        justify-content: flex-start;
    }

    .modal-body {
        padding: 1.5rem 1.25rem;
    }

    .modal-body .form-group {
        margin-bottom: 1.5rem;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.advanced-toggle {
    padding: 0.5rem 1.5rem;
}

.advanced-toggle label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.advanced-field {
    display: none;
}

/* Collapsible Sections */
.modal-sections {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1.5rem 1.5rem;
}

.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-input);
    transition: var(--transition);
}

.form-section.active {
    border-color: var(--primary);
    background: transparent;
}

.form-section-header {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    user-select: none;
    transition: var(--transition);
}

.form-section-header:hover {
    background: rgba(0, 0, 0, 0.05);
}

.form-section.active .form-section-header {
    background: var(--primary);
    color: white;
}

.form-section-header .chevron {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.form-section.active .chevron {
    transform: rotate(180deg);
}

.form-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
    padding: 0 1rem;
}

.form-section.active .form-section-content {
    max-height: 2000px;
    transition: max-height 0.4s cubic-bezier(1, 0, 1, 0);
    padding: 1rem;
}

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


/* FAB */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-add {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
}

.fab-add:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
}

.fab-close {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 20px rgba(244, 63, 94, 0.5);
    transform: rotate(90deg);
}

.fab-close:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 24px rgba(244, 63, 94, 0.6);
}

/* Badges */
.badge {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xl);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-long {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-short {
    background: rgba(244, 63, 94, 0.15);
    color: var(--danger);
}

.badge-open {
    background: rgba(14, 165, 233, 0.15);
    color: var(--info);
}

.badge-closed {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .auth-overlay {
        align-items: flex-start;
    }

    .auth-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .auth-visual {
        flex: none;
        width: 100%;
        padding: 5rem 2rem 3rem;
        text-align: center;
        align-items: center;
    }

    .brand-text {
        font-size: 4.5rem;
    }

    .brand-tagline {
        margin: 0 auto;
    }

    .auth-right {
        flex: none;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 4rem 1.5rem;
        min-height: 50vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .decor-card {
        display: none;
    }

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

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

/* Responsive Modal Styles */
@media (max-width: 1024px) {
    .modal {
        max-width: 95vw;
        max-height: 95vh;
    }
}

@media (max-width: 768px) {
    .modal {
        max-width: 98vw;
        max-height: 98vh;
        margin: 1vh;
    }

    .modal h3 {
        padding: 1rem;
        font-size: 1.1rem;
    }

    .modal-sections {
        padding: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem 0;
    }

    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

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

@media (max-width: 600px) {
    .header {
        grid-template-columns: 1fr 1fr;
        height: 60px;
        padding: 0 1rem;
    }

    .header-center {
        display: none;
    }

    .sidebar {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .sidebar-overlay {
        top: 60px;
    }

    .main-content {
        padding: 0.75rem 2%;
    }

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

    .modal-overlay {
        padding: 0;
        align-items: stretch;
    }

    .modal {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        width: 100vw;
    }

    .modal-sections {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem 0;
    }

    .form-group label {
        font-size: 0.7rem;
    }

    .form-actions {
        flex-direction: column;
        padding: 1rem 0.75rem;
        gap: 0.75rem;
    }

    .btn {
        width: 100%;
        padding: 0.875rem;
    }

    .fab {
        bottom: 1rem;
        right: 1rem;
    }

    .brand-text {
        font-size: 3.25rem;
    }

    .auth-visual {
        padding: 4rem 1rem 2rem;
    }

    .auth-card {
        padding: 1.75rem;
    }

    .auth-tabs-container {
        flex-direction: column;
        gap: 0.75rem;
    }
}

.pnl-positive {
    color: var(--success);
    font-weight: 600;
}

.pnl-negative {
    color: var(--danger);
    font-weight: 600;
}

.positive {
    color: var(--success);
}

.negative {
    color: var(--danger);
}

/* Spacing Hack for Trade List Scroll */
#allTradesBody .spinner {
    margin: 4rem auto;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ==================== CONFIGURATION STYLES ==================== */

.config-container {
    padding: 1.75rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

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

.config-header-content h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    background: linear-gradient(135deg, var(--text-primary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.config-header-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.config-actions {
    display: flex;
    gap: 0.75rem;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.config-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.panel-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.panel-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.panel-icon svg {
    width: 24px;
    height: 24px;
}

.panel-title h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.panel-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.panel-content {
    padding: 1.5rem;
}

.lists-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.lists-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.list-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
}

.list-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.02);
}

.list-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.list-section-title svg {
    color: var(--text-secondary);
}

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

.list-count {
    background: var(--bg-card);
    color: var(--primary);
    padding: 0.15rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-left: 0.5rem;
}

.list-section .quick-add {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}

.list-section .quick-add input {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    width: 200px;
    transition: all 0.2s ease;
}

.list-section .quick-add input::placeholder {
    color: #777;
    font-style: italic;
}

.list-section .quick-add input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--glow-primary);
}

.list-section .quick-add .btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.list-section .quick-add .btn-add:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.list-section .quick-add .btn-add:active {
    transform: translateY(0);
}

.list-items {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0rem;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.list-item:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

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

.list-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* Inline Editing */
.inline-edit-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    margin-right: 0.5rem;
}

.btn-icon.btn-success {
    color: #10b981;
}

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

/* Confirmation Modal Improvement */
.list-item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 32px;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* Market specific list item layout */
.market-list-item-main {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
}

.drag-handle-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 0.25rem;
}

.market-name-area {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 0.25rem;
    margin-left: 0.5rem;
}

.market-hierarchy-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.5rem 0;
    margin-left: 1rem;
}

.market-details-list {
    margin-left: 28px;
    margin-top: 4px;
}

.market-item-hierarchy-line {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
    line-height: 1.4;
}

.confirm-modal {
    max-width: 420px !important;
    text-align: center;
    padding: 2.5rem 2rem !important;
}

.confirm-icon {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
}

.confirm-modal-header {
    display: block !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
}

.confirm-modal-header::before {
    display: none !important;
}

.confirm-modal-header h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    display: block;
}

.confirm-modal-body {
    padding: 0 !important;
}

.confirm-modal-body p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.5;
    font-size: 1rem;
}

.confirm-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding-top: 0.5rem;
}

.confirm-modal-actions .btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
}


.list-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.list-item .btn-icon {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.list-item:hover .btn-icon {
    opacity: 1;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-icon:active {
    transform: translateY(0);
}

.btn-icon.sm {
    padding: 4px;
    border-radius: 6px;
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.btn-icon.btn-success:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.btn-xs {
    padding: 0.25rem;
    font-size: 0.75rem;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-list {
    margin-bottom: 2rem;
}

.default-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.default-setting-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.default-setting-item:last-child {
    margin-bottom: 0;
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.setting-market {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.setting-type {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.setting-values {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.add-setting-form {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.add-setting-form h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.setting-form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.input-with-addon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-addon input {
    flex: 1;
    padding: 0.625rem 3rem 0.625rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.input-addon {
    position: absolute;
    right: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

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

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

.btn.full-width {
    width: 100%;
    justify-content: center;
}

/* ==================== TOAST NOTIFICATIONS ==================== */

.toast-container {
    position: fixed;
    pointer-events: none;
    z-index: 6000;
}

.toast {
    pointer-events: auto;
    width: 320px;
    max-width: 320px;
    padding: 0.875rem 1.125rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: toastSlideIn 0.3s ease-out;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.toast-success {
    background: rgba(16, 185, 129, 0.95);
    color: white;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast-error {
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast-info {
    background: rgba(59, 130, 246, 0.95);
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.toast-warning {
    background: rgba(245, 158, 11, 0.95);
    color: white;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.toast-icon {
    font-size: 1rem;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.toast:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.15);
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==================== NOTIFICATION CENTER STYLES ==================== */

.notification-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.notification-trigger:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.discipline-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

.discipline-trigger:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
    border: 2px solid var(--bg-primary);
}

.notification-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    max-height: 500px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 5000;
    overflow: hidden;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: popoverFadeIn 0.2s ease-out;
}

.notification-popover.active {
    display: flex;
}

.notification-header {
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notification-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-list::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

.notification-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.no-notifications {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.no-notifications svg {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.no-notifications p {
    margin: 0;
    font-size: 0.85rem;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--bg-card-hover);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    min-width: 0;
}

.notification-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.notification-success .notification-icon {
    background: var(--success-light);
    color: var(--success);
}

.notification-error .notification-icon {
    background: var(--danger-light);
    color: var(--danger);
}

.notification-info .notification-icon {
    background: var(--info-light);
    color: var(--info);
}

.notification-text {
    flex: 1;
    min-width: 0;
}

.notification-text p {
    margin: 0 0 0.25rem 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    word-wrap: break-word;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0;
    margin-top: 0.125rem;
}

.notification-item:hover .notification-close {
    opacity: 1;
}

.notification-close:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* Portfolio Management — Redesign */
/* ==================== PORTFOLIO MATRIX CONSOLE ==================== */
.portfolio-matrix-console {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0.5rem;
    perspective: 1000px;
}

/* Matrix Header */
.matrix-header {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(2, 6, 23, 0.9));
    border: 1px solid var(--border-light);
    border-radius: 30px;
    padding: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(99, 102, 241, 0.05);
}

.matrix-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(99, 102, 241, 0.03) 1px, rgba(99, 102, 241, 0.03) 2px);
    pointer-events: none;
}

.matrix-identity {
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 2;
}

.matrix-ring {
    width: 80px;
    height: 80px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: ringRotate 10s linear infinite;
}

.matrix-ring::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    top: -5px;
    box-shadow: 0 0 15px var(--primary);
}

.ring-inner {
    width: 100%;
    height: 100%;
    border: 1px dashed var(--primary-light);
    border-radius: 50%;
    opacity: 0.5;
}

.glitch-text {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    color: white;
    letter-spacing: -1px;
    position: relative;
}

.matrix-text p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0.5rem 0 0 0;
    max-width: 400px;
}

/* Matrix Stats */
.matrix-stats {
    display: flex;
    gap: 1.5rem;
    z-index: 2;
}

.m-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 160px;
    transition: all 0.3s ease;
}

.m-stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.m-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.m-stat-icon.primary {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.m-stat-icon.success {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.m-stat-info {
    display: flex;
    flex-direction: column;
}

.m-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    line-height: 1.2;
}

.m-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Matrix Deck */
.matrix-deck {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.deck-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.deck-panel:hover {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border-color: var(--border-light);
}

.deck-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
}

.deck-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.deck-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    position: relative;
}

.trading .deck-indicator {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.investment .deck-indicator {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.deck-indicator::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: pulseIcon 2s infinite;
}

.deck-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.deck-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Matrix Card V3 */
.matrix-card-v3 {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: all 0.3s ease;
    position: relative;
}

.matrix-card-v3:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary);
    transform: translateX(5px);
}

.card-top-v3 {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-identity-v3 {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.trading .card-icon-box {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
}

.investment .card-icon-box {
    background: linear-gradient(135deg, var(--success), #059669);
}

.card-names-v3 h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
}

.card-names-v3 .status {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
}

.status .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--success);
}

.card-actions-v3 {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.matrix-card-v3:hover .card-actions-v3 {
    opacity: 1;
}

.card-body-v3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-stat-v3 {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mini-stat-v3 .lab {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.mini-stat-v3 .val {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Empty Deployment */
.empty-deployment {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.empty-wireframe {
    width: 100px;
    height: 100px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wire-box {
    width: 60px;
    height: 60px;
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    animation: boxPulse 2s infinite ease-in-out;
}

.wire-line {
    position: absolute;
    width: 40px;
    height: 2px;
    background: var(--border-light);
    right: -20px;
    top: 50%;
}

/* Dragging State for Matrix Cards */
.matrix-card-v3.dragging {
    opacity: 0.4;
    border-style: dashed;
    border-color: var(--primary);
    transform: scale(0.98);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.2);
    pointer-events: none;
}

.matrix-card-v3.dragging * {
    pointer-events: none;
}

/* Action Button Refinements */
.card-actions-v3 .btn-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-actions-v3 .btn-icon:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.card-actions-v3 .btn-icon.btn-danger:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: #f43f5e;
    color: #f43f5e;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}

.card-actions-v3 .btn-icon svg {
    transition: transform 0.2s ease;
}

.card-actions-v3 .btn-icon:active svg {
    transform: scale(0.9);
}

/* Animations */
@keyframes ringRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes pulseIcon {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

@keyframes boxPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Utility Glow Buttons */
.btn-glow {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-glow:hover::after {
    opacity: 1;
}

/* Scrollbar Customization */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive adjustments */
@media (max-width: 1100px) {
    .matrix-deck {
        grid-template-columns: 1fr;
    }

    .matrix-header {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .matrix-identity {
        flex-direction: column;
    }
}

/* Responsive adjustments */
@media (max-width: 1100px) {
    .overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .config-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .portfolios-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .portfolio-stats {
        justify-content: center;
    }

    .section-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .config-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

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

    .portfolios-header {
        flex-direction: column;
    }

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

@media (max-width: 768px) {
    .config-container {
        padding: 1rem;
    }

    .config-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .config-actions {
        width: 100%;
        justify-content: stretch;
    }

    .config-actions .btn {
        flex: 1;
    }

    .panel-header {
        padding: 1rem;
    }

    .panel-icon {
        width: 40px;
        height: 40px;
    }

    .panel-icon svg {
        width: 20px;
        height: 20px;
    }

    .panel-title h3 {
        font-size: 1.1rem;
    }

    .panel-content {
        padding: 1rem;
    }

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

    .default-setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .setting-values {
        align-self: flex-start;
    }

    .toast-container {
        right: 1rem !important;
        left: auto !important;
    }

    .toast {
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
    }

    /* Ensure toast stays within viewport on very small screens */
    @media (max-width: 480px) {
        .toast {
            width: calc(100vw - 1rem);
            max-width: calc(100vw - 1rem);
        }
    }
}

.notification-modal {
    max-width: 95vw;
    margin: 1rem;
}

.notification-header {
    padding: 1rem;
}

.notification-item {
    padding: 1rem;
}

/* ==================== MARKETS & EXCHANGES ==================== */

.exchange-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    transition: var(--transition);
}

.exchange-item:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}

.exchange-item .settings-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.exchange-item .settings-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
}

.exchange-item h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.exchange-item .exchange-details {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.checkbox-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    transition: var(--transition);
}

.checkbox-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 3px;
    position: relative;
    transition: var(--transition);
}

.checkbox-label input[type="checkbox"]:checked+.checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.select-all-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.select-all-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
}

/* ==================== TRADING RULES REDESIGN (PREMIUM) ==================== */

.rules-pane-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.4s ease-out;
}

/* Rules Dashboard Header Stats */
.rules-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.rules-stat-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rules-stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.rules-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15), rgba(var(--primary-rgb), 0.05));
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.2);
}

.rules-stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.rules-stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.rules-stat-info {
    display: flex;
    flex-direction: column;
}

.rules-stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.rules-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Rules Layout Grid */
.rules-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Rule List Content */
.rules-engine-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-subtitle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.section-subtitle-row h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.categories-manager {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.category-tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    min-height: 40px;
}

.category-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    transition: var(--transition);
}

.category-tag:hover {
    background: rgba(var(--primary-rgb), 0.2);
    transform: translateY(-1px);
}

.category-tag .remove-btn {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-size: 0.7rem;
    transition: var(--transition);
}

.category-tag .remove-btn:hover {
    background: var(--danger);
}

.rules-pane-wrapper .quick-add {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.rules-pane-wrapper .quick-add input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 250px;
    transition: var(--transition);
}

.rules-pane-wrapper .quick-add input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    outline: none;
}

.rules-pane-wrapper .quick-add .btn-primary {
    padding: 0.6rem 1.25rem;
    height: auto;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.rules-pane-wrapper .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(var(--primary-rgb), 0.3);
}

/* Rule Card (Premium Redesign) */
.rule-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.rule-card:hover {
    border-color: rgba(var(--primary-rgb), 0.4);
    border-left-width: 6px;
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-4px) translateX(2px);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

.rule-card-drag-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: grab;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--border-light);
    opacity: 0.5;
    transition: var(--transition);
}

.rule-card:hover .rule-card-drag-handle {
    opacity: 1;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.rule-card-content {
    padding: 1.25rem 1.25rem 1.25rem 3rem;
    cursor: pointer;
}

.rule-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.rule-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rule-card-title h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.rule-card-priority {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.rule-card-actions {
    display: flex;
    gap: 0.5rem;
}

.rule-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
}

.rule-action-btn:hover {
    transform: scale(1.1);
}

.rule-action-btn.edit:hover {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-color: var(--primary-light);
}

.rule-action-btn.duplicate:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.rule-action-btn.delete:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border-color: rgba(244, 63, 94, 0.3);
}

.rule-card-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.rule-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rule-section label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.rule-conditions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rule-chip {
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.rule-card:hover .rule-chip {
    border-color: rgba(var(--primary-rgb), 0.2);
    color: var(--text-primary);
}

.rule-chip.global {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--primary-rgb), 0.05));
    border-color: rgba(var(--primary-rgb), 0.2);
    color: var(--primary);
}

.rule-grid-layout {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1.5rem;
}

.rule-leverage-badge {
    height: 100%;
    display: flex;
    align-items: center;
}

.rule-leverage-badge span {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--warning);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.rule-leverage-badge .none,
.rule-leverage-badge .default {
    color: var(--warning);
    opacity: 0.8;
    font-size: 0.9rem;
    font-style: italic;
}

.rule-charges-mini-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.rule-charge-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-left: 3px solid var(--primary);
}

.rule-charge-item:hover {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.charge-name-row {
    margin-bottom: 2px;
}

.charge-cat {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

.charge-flow-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.flow-prefix {
    font-weight: 500;
    opacity: 0.5;
    font-style: italic;
}

.flow-basis,
.flow-side {
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

/* Specific coloring for flow elements if needed */
.flow-basis.basis-turnover {
    color: #818cf8;
    background: rgba(129, 140, 248, 0.1);
}

.flow-basis.basis-margin {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.1);
}

.flow-basis.basis-quantity {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.flow-basis.basis-other_categories {
    color: #f472b6;
    background: rgba(244, 114, 182, 0.1);
}

.flow-side.side-both {
    color: #94a3b8;
}

.flow-side.side-entry {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
}

.flow-side.side-exit {
    color: #f87171;
    background: rgba(248, 113, 113, 0.05);
}

.charge-value-row {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed rgba(255, 255, 255, 0.05);
}

.charge-formula {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--primary-light);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: -0.2px;
}

.rule-charge-item::after {
    content: '';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.2;
    box-shadow: 0 0 10px var(--primary);
}

.rule-charge-item:hover::after {
    opacity: 0.6;
    transform: translateY(-50%) scale(1.2);
}


/* Modal Form Specifics */
.modal-rule-form-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0.5rem 0;
}

.modal-section-group {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.2s ease;
}

.modal-section-group:hover {
    border-color: rgba(var(--primary-rgb), 0.15);
}

.modal-section-header-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.modal-section-header-inline svg {
    color: var(--primary);
    opacity: 0.8;
}

.modal-section-header-inline span {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.partial-exit-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--apex-border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s var(--apex-ease);
}

.pe-header {
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pe-header:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.pe-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    font-family: var(--apex-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--apex-accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pe-title svg {
    transition: transform 0.3s ease;
}

.partial-exit-card.collapsed .pe-title svg {
    transform: rotate(-90deg);
}

.pe-summary {
    font-family: var(--apex-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pe-summary span {
    color: #fff;
    font-weight: 700;
}

.pe-body {
    padding: 1.5rem;
    transition: all 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.partial-exit-card.collapsed .pe-body {
    max-height: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.category-charge-override-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--apex-border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s var(--apex-ease);
    animation: apexSlideDown 0.4s var(--apex-ease);
}

.category-charge-override-card.collapsed .pe-body {
    max-height: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}


.redesign-grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.modal-rule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.modal-rule-full {
    grid-column: 1 / -1;
}

#modalChargeRowsContainer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.add-rule-sub-actions {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.add-rule-sub-actions .btn-outline {
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    transition: all 0.2s;
}

.add-rule-sub-actions .btn-outline:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.3);
    transform: translateY(-2px);
}

/* Duplicate/Edit Buttons */
.btn-icon.sm {
    width: 28px;
    height: 28px;
}

.btn-icon.sm svg {
    width: 14px;
    height: 14px;
}

.trading-rule-conditions {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    min-width: 0;
    padding-top: 0.1rem;
}

.trading-rule-values {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.trading-rule-leverage,
.trading-rule-charges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.83rem;
    color: var(--text-secondary);
}

.trading-rule-leverage svg,
.trading-rule-charges svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.trading-rule-leverage strong,
.trading-rule-charges strong {
    color: var(--text-primary);
}

.rule-charge-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--primary);
    white-space: nowrap;
}

.rule-charge-tag.muted {
    background: var(--bg-card);
    border-color: var(--border-light);
    color: var(--text-muted);
}

.rule-charge-tag strong {
    color: inherit;
}

/* Responsive */
@media (max-width: 768px) {
    .rule-conditions-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .trading-rule-card {
        flex-direction: column;
        gap: 0.75rem;
    }

    .trading-rule-values {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .rule-conditions-row {
        grid-template-columns: 1fr;
    }

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

/* ==================== FORMULA BUILDER ROWS ==================== */

/* Outer container per charge row */
.charge-formula-row {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.charge-formula-row:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Top bar: Category + Formula Type + Remove */
.charge-formula-top {
    display: grid;
    grid-template-columns: 1fr 1.4fr 36px;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.charge-formula-top select {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.charge-formula-top select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--glow-primary);
}

.charge-row-remove {
    margin-left: auto;
}

/* Expandable fields area */
.charge-formula-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    padding: 0.75rem;
    align-items: flex-end;
}

/* Each field group within a formula row */
.formula-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 130px;
    flex: 1;
}

.formula-field-group--wide {
    flex-basis: 100%;
    min-width: 100%;
}

.formula-field-group label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.formula-field-group select,
.formula-field-group input[type="number"] {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.formula-field-group select:focus,
.formula-field-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--glow-primary);
}

/* Left-side ₹ addon */
.input-addon-left {
    border-right: none !important;
    border-left: 1px solid var(--border) !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 7px !important;
    border-bottom-left-radius: 7px !important;
    border-right: none;
}

/* When ₹ addon is on the left, input border adjustments */
.input-with-addon:has(.input-addon-left) input {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 7px !important;
    border-bottom-right-radius: 7px !important;
    border-left: none;
    border-right: 1px solid var(--border);
}

/* Base categories multi-select */
.ff-base-categories {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
    min-height: 70px;
}

.ff-base-categories:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--glow-primary);
}

.ff-base-categories option:checked {
    background: var(--primary);
    color: white;
}

/* Small hint text */
.formula-hint {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Modal Rule Layout Improvements */
.modal-rule-form-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 0;
}

.modal-rule-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-rule-actions .btn-outline {
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.modal-rule-actions .btn-outline:hover {
    background: rgba(var(--primary-rgb), 0.05);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

#ruleChargesSection {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

.charge-rows-empty {
    padding: 2.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* Responsive adjustments for formula builder */
@media (max-width: 768px) {
    .charge-formula-top {
        grid-template-columns: 1fr 36px;
        grid-template-rows: 1fr 1fr;
    }

    .charge-formula-top select:first-child {
        grid-column: 1;
        grid-row: 1;
    }

    .charge-formula-top select:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }

    .charge-row-remove {
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .trading-rule-header {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .formula-field-group {
        min-width: 100%;
        flex-basis: 100%;
    }

    .rule-charge-entry {
        flex-wrap: wrap;
    }

    .rule-charge-type-badge {
        margin-left: 0;
    }
}

/* New Trade Modal Styles */
.exit-type-fields {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.partial-exit-row {
    position: relative;
    transition: all 0.2s;
}

.partial-exit-row:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.hud-na {
    color: var(--text-secondary) !important;
    font-style: italic;
    opacity: 0.6;
}

.hud-metric-grid {
    margin-bottom: 0.5rem;
}

.hud-toggle-row label:hover {
    color: var(--text-primary);
}

.override-section input {
    background: rgba(var(--primary-color-rgb), 0.05);
    border-color: rgba(var(--primary-color-rgb), 0.2);
}

.override-section input:focus {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

/* Market Hierarchy UI in Modals */
.market-hierarchy-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.hierarchy-broker-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.hierarchy-broker-section:hover {
    border-color: var(--primary-light);
    background: var(--bg-card-hover);
}

.hierarchy-broker-header {
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}

.hierarchy-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}

.hierarchy-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.broker-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.hierarchy-exchanges-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hierarchy-exchange-item {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.hierarchy-exchange-header {
    margin-bottom: 0.75rem;
}

.exchange-name {
    font-size: 0.9rem;
    color: var(--primary-light);
}

.hierarchy-segments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border);
}

.hierarchy-segment-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 4px;
    transition: 0.2s;
}

.hierarchy-segment-label:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.empty-state-hint {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

.no-items-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.hierarchy-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Scrollbar for hierarchy list */
.market-hierarchy-list::-webkit-scrollbar {
    width: 5px;
}

.market-hierarchy-list::-webkit-scrollbar-track {
    background: transparent;
}

.market-hierarchy-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 10px;
}

/* Market Hierarchy UI - Add Market Modal */
.market-hierarchy-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
    padding-right: 0.5rem;
}

/* Adjust columns for smaller screens */
@media (max-width: 768px) {
    .market-hierarchy-list {
        grid-template-columns: 1fr;
    }
}

.h-broker-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
    margin-bottom: 0.75rem;
}

.h-broker-card:hover {
    border-color: var(--primary-light);
}

.h-broker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.h-broker-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.h-broker-info .h-name {
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
}

.h-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-light);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-text:hover {
    color: var(--primary);
    text-decoration: underline;
}

.btn-expand,
.btn-expand-sm {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.3s;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-expand.active,
.btn-expand-sm.active {
    transform: rotate(180deg);
    color: var(--primary);
}

.h-exchanges-list {
    padding: 0.5rem 1rem 1rem 2.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.h-exchange-item {
    border-left: 1px solid var(--border);
    margin-top: 0.25rem;
    padding-left: 1rem;
}

.h-exchange-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem 0.5rem 0;
}

.h-segments-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0 0.75rem 0;
}

.h-segment-checkbox {
    cursor: pointer;
    position: relative;
}

.h-segment-checkbox input {
    display: none;
}

.h-segment-box {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.h-segment-checkbox input:checked+.h-segment-box {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 10px var(--glow-primary);
}

.h-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.4rem 0;
}

.custom-checkbox {
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox .checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 4px;
    transition: 0.2s;
}

.custom-checkbox:hover input~.checkmark {
    border-color: var(--primary);
}

.custom-checkbox input:checked~.checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked~.checkmark:after {
    display: block;
}

/* Sub-hierarchy Checkboxes */
.custom-checkbox.sm,
.custom-checkbox.xs {
    padding-left: 24px;
    font-size: 0.85rem;
}

.custom-checkbox.sm .checkmark,
.custom-checkbox.xs .checkmark {
    height: 16px;
    width: 16px;
}

.custom-checkbox.xs {
    font-size: 0.75rem;
}

/* Improve visibility of unselected boxes on dark backgrounds */
.h-broker-card .custom-checkbox .checkmark {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.05);
}

.h-broker-card .custom-checkbox:hover input~.checkmark {
    border-color: var(--primary);
}

/* Configuration Lists - Edit/Delete Actions */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.list-item:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.list-item-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.list-item:hover .list-item-actions {
    opacity: 1;
}

.list-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Quick Add Fields */
.quick-add {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-add input {
    flex: 1;
    min-width: 0;
}

/* Replaced by consolidated hierarchy styles below */

.market-hierarchy-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    margin-top: 1rem;
}

/* Ensure individual broker cards don't feel too cramped */
.h-broker-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
}

.h-broker-header {
    padding: 0.75rem 1rem;
}

.h-broker-body {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.05);
}

.h-broker-body.expanded {
    max-height: 1000px;
    padding: 0.5rem 1rem 1rem 1rem;
    border-top: 1px solid var(--border);
}

.h-exchange-item {
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
}

.h-exchange-header {
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.h-exchange-body {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.03);
}

.h-exchange-body.expanded {
    max-height: 500px;
    padding: 0.75rem;
    border-top: 1px dashed var(--border);
}

.h-broker-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hierarchy-segments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-icon.sm {
    width: 28px;
    height: 28px;
}

.btn-icon.sm svg {
    width: 14px;
    height: 14px;
}

.btn-icon.active svg {
    transform: rotate(180deg);
}

.btn-icon svg {
    transition: transform 0.2s ease;
}

/* Fix for nested bodies being cut off */
.h-broker-body,
.h-exchange-body {
    overflow: hidden;
    /* Ensure clean expansion */
}

/* Ensure custom-checkbox is consistent in hierarchy */
.market-hierarchy-list .custom-checkbox {
    margin-bottom: 0;
}

/* Collapsible Sections & Headers */
.list-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border);
}

.list-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    flex: 1;
    user-select: none;
}

.list-section-title:hover {
    color: var(--primary);
}

.list-section.collapsed .list-items {
    display: none;
}

/* Quick Add in Header */
.quick-add {
    display: flex !important;
    /* Force show in header */
    align-items: center;
    gap: 0.5rem;
}

.quick-add input {
    height: 28px;
    padding: 0 0.5rem;
    font-size: 0.8rem;
    width: 100px;
}

.quick-add .btn-sm {
    padding: 2px 6px;
    height: 28px;
}

.collapse-indicator {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.list-section.collapsed .collapse-indicator {
    transform: rotate(-90deg);
}

/* Strategy Enhanced Management */
.strategy-modal-body textarea {
    resize: vertical;
    min-height: 120px;
    max-height: 250px;
}

.strategy-entry-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}


.strategy-list-item-main {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding-right: 1rem;
}

.strategy-content-area {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.strategy-item-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 600px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.strategy-item-description.empty {
    font-style: italic;
    opacity: 0.5;
}

.list-item:hover .strategy-item-description {
    -webkit-line-clamp: unset;
    color: var(--text-secondary);
}

/* Drag and Drop Styles */
.list-item {
    cursor: default;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
    position: relative;
    background: var(--bg-card);
}

.list-item.dragging {
    opacity: 0.4;
    border: 1px dashed var(--primary);
}

.drag-handle {
    cursor: grab;
    padding: 0.5rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.drag-handle:hover {
    color: var(--primary);
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle.sm svg {
    width: 12px;
    height: 12px;
}

/* Charge Rules Reordering handle */
.charge-rule-item {
    position: relative;
}

.charge-rule-item .drag-handle {
    margin-right: 0.5rem;
}

/* Scrollbars */
.market-hierarchy-list::-webkit-scrollbar {
    width: 6px;
}

.market-hierarchy-list::-webkit-scrollbar-track {
    background: transparent;
}

.market-hierarchy-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.market-hierarchy-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.portfolio-hierarchy-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    height: auto;
    max-height: none;
    overflow: visible;
}

/* ==========================================================================
   NEXUS MARKET CARD - SIMPLIFIED ARCHITECTURE (REDESIGN)
   ========================================================================== */

.nexus-market-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.nexus-market-card:hover {
    border-color: rgba(var(--primary-rgb), 0.25);
    background: rgba(15, 23, 42, 0.6);
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
}

.nexus-market-card.active-selection {
    border-color: rgba(var(--primary-rgb), 0.4);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.1);
}

.market-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.3s;
}

.market-card-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

.market-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.2px;
}

.market-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.card-toggle-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nexus-market-card.expanded .market-card-header {
    background: rgba(var(--primary-rgb), 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.nexus-market-card.expanded .card-toggle-icon {
    transform: rotate(180deg);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.market-card-body {
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.1);
}

.nexus-market-card.expanded .market-card-body {
    max-height: 2500px;
    padding: 1.5rem 1.75rem;
}

/* Capability Grid */
.capability-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.broker-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.015);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.broker-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.broker-identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding-right: 1.25rem;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.broker-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-light);
    letter-spacing: 0.5px;
}

.capability-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-left: 2rem;
}

/* Cyber-Console Technical Chips */
.nexus-chip {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    color: var(--text-muted);
    position: relative;
    overflow: hidden;
    height: 32px;
}

.nexus-chip::before {
    content: '';
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
    margin-right: 10px;
}

.nexus-chip span {
    padding-right: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.nexus-chip:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.nexus-chip input {
    display: none;
}

.nexus-chip:has(input:checked) {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.3);
    color: var(--primary-light);
    box-shadow: inset 0 0 12px rgba(var(--primary-rgb), 0.05);
}

.nexus-chip:has(input:checked)::before {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

/* Active Flow Animation */
.nexus-chip:has(input:checked)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: nexus-flow 2s linear infinite;
}

@keyframes nexus-flow {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.empty-hint {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    opacity: 0.6;
}

/* p-segment-row consolidated above */

.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.6rem;
}

.selection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.selection-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.selection-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.default-selector {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.default-selector input {
    margin: 0;
    cursor: pointer;
}

.default-selector label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.default-selector label:hover {
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--text-primary);
}

.p-market-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.default-selector.active {
    color: var(--primary);
}

.hierarchy-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.hierarchy-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hierarchy-toggle.active svg {
    transform: rotate(90deg);
}

/* Portfolio Modal Refinements */
#addPortfolioModal .modal-section-header h4 {
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.85rem;
    opacity: 0.9;
}

#addPortfolioModal .modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

#addPortfolioModal .modal-body::-webkit-scrollbar {
    width: 6px;
}

#addPortfolioModal .modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Consolidated hierarchy styles above */

.config-section-header h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#addPortfolioModal .selection-item span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Step-based Modal Configuration Body */
.modal-config-step {
    position: relative;
    padding: 1.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-config-step:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.modal-config-step .step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-config-step .step-num {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--primary);
    opacity: 0.3;
    font-family: 'Outfit', sans-serif;
    line-height: 1;
}

.modal-config-step .step-info h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    letter-spacing: 0.01em;
}

.modal-config-step .step-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0.25rem 0 0 0;
    opacity: 0.8;
}

.modal-config-step .step-icon {
    margin-left: auto;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-radius: 10px;
}

.modal-config-step .step-content {
    margin-top: 0.5rem;
}

.modal-config-step .selection-grid {
    background: rgba(0, 0, 0, 0.25);
}

.modal-config-step .portfolio-hierarchy-container {
    background: rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   NEON NEXUS: MASTERPIECE CONFIGURATOR
   ========================================================================== */

:root {
    --nexus-glass: rgba(15, 23, 42, 0.45);
    --nexus-border: rgba(255, 255, 255, 0.08);
    --nexus-glow: rgba(99, 102, 241, 0.15);
}

#addPortfolioModal .modal {
    background: var(--bg-dark);
    border: 1px solid var(--nexus-border);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8), 0 0 100px rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(25px);
    overflow: hidden;
    max-width: 950px !important;
}

#addPortfolioModal .modal-body {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    min-height: 580px;
    max-height: 85vh !important;
}

/* Horizontal Progress Indicator */
.nexus-wizard-progress {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 4rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--nexus-border);
    position: relative;
}

.nexus-wizard-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 4rem;
    right: 4rem;
    height: 2px;
    background: var(--nexus-border);
    z-index: 1;
}

.wizard-node {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 2px solid var(--nexus-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    z-index: 2;
    transition: all 0.4s ease;
    color: var(--text-muted);
}

.wizard-node.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--glow-primary);
}

.wizard-node.completed {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

/* Step Container */
.wizard-step-container {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 3.5rem;
    position: relative;
}

.wizard-step-pane {
    display: none;
    animation: fadeInStep 0.5s ease forwards;
}

.wizard-step-pane.active {
    display: block;
}

@keyframes fadeInStep {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Feature Cards */
.nexus-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.25rem;
}

.nexus-card {
    background: var(--nexus-glass);
    border: 1px solid var(--nexus-border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    position: relative;
}

.nexus-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.nexus-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.nexus-card-icon {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.nexus-card.selected .nexus-card-icon {
    color: var(--primary);
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--primary));
}

/* Review Summary */
.review-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--nexus-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.review-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.review-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.review-value {
    color: var(--primary-light);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Wizard Footer */
.wizard-footer {
    padding: 1.25rem 2.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--nexus-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.nexus-p-tag {
    transition: all 0.2s ease;
}

.nexus-p-tag:hover {
    background: rgba(var(--primary-rgb), 0.1) !important;
    border-color: var(--primary) !important;
}

.nexus-p-tag input:checked+span {
    color: var(--primary);
}

.nexus-p-tag input:checked {
    accent-color: var(--primary);
}

/* Scrollbar refinement for wizard container */
.wizard-step-container::-webkit-scrollbar {
    width: 4px;
}

.wizard-step-container::-webkit-scrollbar-thumb {
    background: var(--nexus-border);
    border-radius: 10px;
}

/* Apex Wizard Layout Overrides */
#addPortfolioModal .modal {
    display: flex;
    flex-direction: column;
}

#addPortfolioModal .modal-body {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    /* Fixed head/foot */
    height: 600px;
}

#addPortfolioModal .wizard-step-container {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 3.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--nexus-border) transparent;
}

#addPortfolioModal .wizard-footer {
    flex-shrink: 0;
}

/* Character Counter Position */
.form-group.name-input-group {
    position: relative;
}

#addPortfolioModal .char-counter {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}


/* NEON NEXUS: MASTERPIECE CONFIGURATOR - REFINED LAYOUT */
#addPortfolioModal .modal {
    max-height: 90vh;
    display: flex !important;
    flex-direction: column !important;
}

#addPortfolioModal .modal-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    overflow: hidden !important;
}

#addPortfolioModal .wizard-step-container {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 2.5rem 3.5rem !important;
    scrollbar-width: thin;
    scrollbar-color: var(--nexus-border) transparent;
}

/* Character Counter: Floating Right End of Input */
.nexus-wizard-input-wrapper.premium {
    position: relative;
    margin: 0;
    max-width: 100%;
}

.nexus-wizard-input-wrapper.premium input,
.nexus-wizard-input-wrapper.premium textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    padding: 1.25rem !important;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left !important;
}

.char-counter-outside {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nexus-wizard-input-wrapper.premium input:focus,
.nexus-wizard-input-wrapper.premium textarea:focus {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 25px rgba(var(--primary-rgb), 0.15);
    outline: none;
}

.identity-step-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    align-items: center;
    padding: 2rem 1rem;
    min-height: 350px;
}

.identity-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.identity-preview-card {
    width: 260px;
    height: 320px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: identity-float 6s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.identity-preview-card:hover {
    border-color: rgba(var(--primary-rgb), 0.3);
    transform: scale(1.02);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.identity-preview-card:active {
    transform: scale(0.98);
}

.identity-preview-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.1) 0%, transparent 70%);
    opacity: 0.5;
    pointer-events: none;
}

.identity-avatar {
    width: 80px;
    height: 80px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 2px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    margin-bottom: 1.5rem;
    transition: all 0.5s ease;
}

.identity-preview-card:hover .identity-avatar {
    transform: scale(1.1) rotate(5deg);
    background: rgba(var(--primary-rgb), 0.2);
    box-shadow: 0 0 30px rgba(var(--primary-rgb), 0.3);
}

.identity-badge {
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: white;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1rem;
}

.identity-badge.trading {
    background: var(--primary);
    /* Blue */
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.4);
}

.identity-badge.investment {
    background: #10b981;
    /* Green */
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.identity-name-preview {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    color: white;
    word-break: break-word;
}

.nexus-label-glow {
    font-size: 0.7rem;
    color: var(--primary);
    letter-spacing: 2px;
    font-weight: 800;
    margin-bottom: 0.75rem;
    display: block;
    text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    opacity: 0.6;
}

@keyframes identity-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@media (max-width: 768px) {
    .identity-step-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .identity-details .wizard-step-header {
        align-items: center;
    }

    .nexus-wizard-input-wrapper.premium input {
        text-align: center !important;
        padding-right: 1.25rem !important;
    }

    .char-counter,
    .char-counter-outside {
        display: none;
    }
}

/* Wizard Header/Footer Shadow/Borders */
.modal-header {
    border-bottom: 1px solid var(--nexus-border);
    background: rgba(var(--bg-rgb), 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.wizard-footer {
    border-top: 1px solid var(--nexus-border);
    padding: 1.5rem 2.5rem !important;
    background: rgba(var(--bg-rgb), 0.5);
    backdrop-filter: blur(5px);
}

/* Step 2 Redesign Elements */
.wizard-category-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
}

.wizard-category-header h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(var(--primary-rgb), 0.3);
}

.wizard-category-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}


/* Review Page Visuals */
.review-section-title {
    font-size: 0.65rem;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    opacity: 0.8;
}

.review-tag-group {
    margin-bottom: 0.75rem;
}

.review-sublabel {
    display: block;
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.nexus-tag {
    padding: 2px 8px;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-light);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.nexus-info-banner {
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.nexus-info-banner p {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--nexus-border);
    border-radius: 10px;
}

/* NEON NEXUS: WIZARD TEXT & DIVIDER REFINEMENT */
#addPortfolioModal .modal-subtitle {
    font-size: 0.75rem !important;
    color: var(--text-secondary) !important;
    margin-top: 2px !important;
    opacity: 0.7;
    font-weight: 500;
}

#addPortfolioModal .text-muted {
    font-size: 0.8rem;
    color: var(--text-secondary) !important;
    opacity: 0.75;
}

#addPortfolioModal .modal-header {
    border-bottom: 1px solid var(--nexus-border) !important;
    padding-bottom: 1.25rem !important;
}


.wizard-step-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--nexus-border);
    position: relative;
}

.wizard-step-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.3;
}


.wizard-step-header h3 {
    margin-bottom: 0.4rem !important;
}

.wizard-step-header .text-muted {
    font-size: 0.75rem !important;
    color: var(--text-secondary) !important;
    opacity: 0.7;
    margin: 0;
}

/* REFINED WIZARD CARDS & HIERARCHY */
.nexus-wizard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.25rem;
}

.nexus-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.nexus-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.nexus-card.selected {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.08);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.15);
    transform: translateY(-2px);
}

.nexus-card.selected::before {
    opacity: 0.05;
}

.nexus-card>* {
    position: relative;
    z-index: 1;
}

.nexus-card-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 0.75rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.nexus-card.selected .nexus-card-icon {
    color: var(--primary);
}

/* Hierarchy Nodes */
.p-market-item {
    transition: all 0.3s ease;
}

.p-market-item:hover {
    border-color: rgba(var(--primary-rgb), 0.3) !important;
}

.hierarchy-toggle {
    transition: transform 0.3s ease;
}

.hierarchy-toggle.active {
    transform: rotate(90deg);
    color: var(--primary);
}

/* Defaults Page Refinement */
.defaults-standard-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--nexus-border);
    border-radius: 16px;
    padding: 2rem;
}

.context-path-box {
    background: rgba(var(--primary-rgb), 0.02);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.nexus-select-wrapper {
    position: relative;
}

.nexus-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--nexus-border) !important;
    color: var(--text-primary) !important;
    padding: 0.75rem 1rem !important;
    border-radius: 8px !important;
    width: 100%;
    transition: all 0.3s ease;
}

.nexus-select-wrapper select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
}

.nexus-select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.6rem;
    color: var(--text-muted);
    pointer-events: none;
}


.wizard-config-section {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--nexus-border);
    border-radius: 16px;
    padding: 1.5rem;
}

.wizard-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.wizard-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.2), transparent);
}


/* GLASS ACCORDION HIERARCHY */
.p-market-item {
    background: rgba(var(--primary-rgb), 0.02) !important;
    border: 1px solid var(--nexus-border) !important;
    margin-bottom: 1rem !important;
    border-radius: 12px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.p-market-header {
    padding: 1.25rem 1.5rem !important;
    background: rgba(255, 255, 255, 0.02) !important;
    transition: background 0.2s ease !important;
}

.p-market-header:hover {
    background: rgba(var(--primary-rgb), 0.05) !important;
}

.p-market-body {
    padding: 1.5rem !important;
    border-top: 1px solid rgba(var(--primary-rgb), 0.1) !important;
    animation: slideDownIn 0.4s ease-out forwards;
}

@keyframes slideDownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.p-broker-item {
    position: relative;
    padding-left: 1.5rem !important;
    border-left: 1px dashed rgba(var(--primary-rgb), 0.3) !important;
}

.p-broker-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15px;
    width: 10px;
    height: 1px;
    background: rgba(var(--primary-rgb), 0.3);
}

.p-exchange-row {
    background: rgba(255, 255, 255, 0.01) !important;
    border: 1px solid rgba(var(--primary-rgb), 0.05) !important;
    padding: 1rem !important;
    border-radius: 10px !important;
    transition: all 0.2s ease !important;
}

.p-exchange-row:hover {
    border-color: rgba(var(--primary-rgb), 0.2) !important;
    background: rgba(var(--primary-rgb), 0.02) !important;
}

.nexus-p-tag {
    transition: all 0.2s ease !important;
}

.nexus-p-tag:hover {
    border-color: var(--primary) !important;
    background: rgba(var(--primary-rgb), 0.1) !important;
}

/* Fix Visibility clipping */
#portfolioMarketHierarchy {
    padding: 0.5rem !important;
    overflow-y: auto !important;
}

.wizard-config-section {
    overflow: hidden !important;
}

/* ARCHITECTURE PIPES (V3) */
.p-broker-item {
    margin-left: 1rem !important;
    border-left: 2px solid rgba(var(--primary-rgb), 0.15) !important;
    padding-left: 2rem !important;
    position: relative;
    margin-bottom: 2rem !important;
}

.p-broker-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15px;
    width: 20px;
    height: 2px;
    background: rgba(var(--primary-rgb), 0.15);
}

.p-exchange-row {
    position: relative;
    margin-left: 1rem !important;
    border-left: 1px solid rgba(var(--primary-rgb), 0.1) !important;
    padding-left: 1.5rem !important;
}

.p-exchange-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20px;
    width: 15px;
    height: 1px;
    background: rgba(var(--primary-rgb), 0.2);
}

/* EXECUTION CAPABILITY HUB (V3 REDESIGN) */
.execution-hub {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(0, 0, 0, 0.1) 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.75rem;
    border-radius: 24px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.2);
}

.capability-cluster {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 18px;
    transition: border-color 0.3s;
}

.capability-cluster:hover {
    border-color: rgba(var(--primary-rgb), 0.15);
}

.capability-cluster h5 {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary-light);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.capability-cluster h5::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(var(--primary-rgb), 0.2) 0%, transparent 100%);
}

.capability-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nexus-tag-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.nexus-tag-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.nexus-tag-btn.selected {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: rgba(var(--primary-rgb), 0.4);
    color: var(--primary-light);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.1);
}

.tag-glow-orb {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.nexus-tag-btn.selected .tag-glow-orb {
    opacity: 1;
}

.tag-label {
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
}

.no-charges-hint {
    font-size: 0.7rem !important;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.6;
}

.rules-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background: rgba(var(--primary-rgb), 0.03);
    border: 1px dashed rgba(var(--primary-rgb), 0.15);
    border-radius: 20px;
    text-align: center;
    margin-top: 1.5rem;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.rules-empty-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-family: 'Outfit', sans-serif;
}

.rules-empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 320px;
    line-height: 1.5;
}

/* Step 3: Deployment Pipeline Visualization */
.pipeline-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 2;
    transition: all 0.4s ease;
}

.node-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.4s;
}

.pipeline-node.active .node-icon {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
    color: var(--primary-light);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.2);
}

.pipeline-node span {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    font-family: var(--font-mono);
    max-width: 100px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pipeline-node.active span {
    color: white;
}

.pipeline-node label {
    font-size: 0.55rem;
    font-weight: 900;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.4;
}

.pipeline-connector {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
    position: relative;
}

.pipeline-connector::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0%;
    height: 1px;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* ==========================================================================
   THE APEX: NEURAL INTERFACE (V5.0)
   Designed for maximum immersion, speed, and analytical precision.
   ========================================================================== */

:root {
    --apex-bg: var(--bg-dark);
    --apex-surface: var(--bg-elevated);
    --apex-accent: var(--primary);
    --apex-accent-glow: var(--glow-primary);
    --apex-danger: var(--danger);
    --apex-success: var(--success);
    --apex-warning: var(--warning);
    --apex-glass: rgba(255, 255, 255, 0.02);
    --apex-border: var(--border);
    --apex-font: 'Inter', system-ui, -apple-system, sans-serif;
    --apex-mono: 'Space Mono', monospace;
    --apex-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.apex-interface {
    background: var(--apex-surface);
    border: 1px solid var(--apex-border);
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: 
        0 0 0 1px rgba(0, 242, 255, 0.05),
        0 40px 100px -20px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    animation: apexEntrance 0.8s var(--apex-ease);
    backdrop-filter: blur(40px) saturate(150%);
}

@keyframes apexEntrance {
    0% { opacity: 0; transform: scale(0.95) translateY(20px); filter: blur(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* --- Dynamic Background --- */
.apex-background {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.apex-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(var(--primary-rgb), 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--primary-rgb), 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at 50% 50%, black, transparent 80%);
}

.apex-aurora {
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, var(--apex-accent-glow) 0%, transparent 40%);
    opacity: 0.15;
    animation: auroraFloat 20s infinite linear;
}

@keyframes auroraFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(2%, 2%) rotate(180deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

/* --- Structure --- */
.apex-body {
    display: flex;
    height: 820px;
    max-height: 90vh;
    z-index: 1;
}

/* --- Neural Navigation --- */
.apex-nav {
    width: 260px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--apex-border);
    background: rgba(0, 0, 0, 0.2);
}

.apex-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 4rem;
}

.brand-glyph-container {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--apex-border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: inset 0 0 10px rgba(0, 242, 255, 0.1);
}

.trading-helix {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 5px var(--apex-accent-glow));
}

.trading-helix .bar {
    transform-origin: bottom;
    animation: barFlow 3s infinite ease-in-out;
}

.bar.b1 { animation-delay: 0.1s; }
.bar.b2 { animation-delay: 0.3s; }
.bar.b3 { animation-delay: 0.5s; }
.bar.b4 { animation-delay: 0.7s; }

@keyframes barFlow {
    0%, 100% { transform: scaleY(1); opacity: 0.8; }
    50% { transform: scaleY(0.6); opacity: 1; }
}

.trend-line {
    animation: trendPulse 2s infinite linear;
    stroke: var(--apex-accent);
}

@keyframes trendPulse {
    0% { stroke-dashoffset: 20; opacity: 0.4; }
    50% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0.4; }
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-status-tag {
    font-size: 0.55rem;
    color: var(--apex-accent);
    background: rgba(0, 242, 255, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--apex-border);
    margin-top: 6px;
    display: inline-block;
    letter-spacing: 1.5px;
    font-family: var(--apex-mono);
    text-transform: uppercase;
    font-weight: 800;
}


.apex-nav-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.apex-nav-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.4s var(--apex-ease);
    position: relative;
    border: 1px solid transparent;
}

.apex-nav-item .nav-icon {
    width: 24px;
    height: 24px;
    color: var(--apex-accent);
    opacity: 0.4;
    transition: 0.4s;
}

.apex-nav-item span {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
}

.apex-nav-item.active {
    background: rgba(0, 242, 255, 0.05);
    border-color: var(--apex-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.apex-nav-item.active .nav-icon {
    opacity: 1;
    filter: drop-shadow(0 0 8px var(--apex-accent));
}

.apex-nav-item.active span {
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.apex-nav-item.completed .nav-icon {
    color: var(--apex-success);
    opacity: 1;
}

/* --- Main Workspace --- */
.apex-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0; /* Ensures container can shrink to fit parent */
    position: relative;
    overflow: hidden;
}

.close-apex {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--apex-glass);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
    color: rgba(255, 255, 255, 0.4);
}

.close-apex:hover {
    background: var(--apex-danger);
    color: #fff;
    transform: rotate(90deg) scale(1.1);
}

.apex-content-split {
    display: flex;
    flex: 1;
    min-height: 0;
}

.apex-workspace {
    position: relative;
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    min-height: 0; 
    border-right: 1px solid var(--apex-border);
    scroll-behavior: smooth;
    display: flex; /* Ensure it behaves as a flex container */
    flex-direction: column;
}

.apex-global-currency {
    position: absolute;
    top: 3.2rem;
    right: 3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
    backdrop-filter: blur(10px);
}

.currency-mode-label {
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--apex-accent);
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

.apex-global-currency .currency-indicator {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-light);
    border-color: var(--primary);
}

.apex-workspace form {
    height: auto;
    flex: none;
    overflow: visible;
}

/* Custom Scrollbar */
.apex-workspace::-webkit-scrollbar { width: 6px; }
.apex-workspace::-webkit-scrollbar-track { background: transparent; }
.apex-workspace::-webkit-scrollbar-thumb { 
    background: var(--apex-border); 
    border-radius: 10px;
}

/* --- Form Elements --- */
.apex-phase {
    display: none;
    animation: phaseApexSlide 0.6s var(--apex-ease);
}

.apex-phase.active { display: block; }

@keyframes phaseApexSlide {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.apex-phase-header {
    margin-bottom: 3rem;
}

.apex-phase-header h4 {
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.5rem;
}

.apex-phase-header p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
}

.apex-grid-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.apex-input-field {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.25rem;
    transition: 0.3s var(--apex-ease);
}

.apex-input-field:focus-within {
    background: rgba(0, 242, 255, 0.03);
    border-color: var(--apex-accent);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.1);
}

.apex-input-field label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--apex-accent);
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.apex-input-field input,
.apex-input-field select,
.apex-input-field textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0;
}

.apex-input-field select option {
    background: #111;
    color: #fff;
}

/* --- Zenith Cobalt Command: HUD Engine v6.0 --- */
.apex-telemetry.cobalt-console {
    width: 380px;
    background: #020617; /* Deepest Obsidian */
    border-left: 1px solid rgba(0, 242, 255, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.command-deck {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.75rem;
    gap: 2rem;
    position: relative;
    z-index: 2;
    overflow-y: auto;
    scrollbar-width: none;
}

.command-deck::-webkit-scrollbar { display: none; }

/* 🧱 Terminal Hub: Orbital Diagnostic */
.widget-hub {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(2, 6, 23, 0.9) 100%);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.orbital-vortex {
    width: 90px;
    height: 90px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vortex-rings .v-ring {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    border: 1px dashed rgba(0, 242, 255, 0.1);
}

.v-ring.r1 { animation: ringRotateCW 12s linear infinite; }
.v-ring.r2 { transform: scale(0.85); animation: ringRotateCCW 8s linear infinite; border-style: dotted; }

.vortex-core {
    width: 50px;
    height: 50px;
    background: #0ea5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.4);
    z-index: 3;
}

.vortex-core span { font-size: 1.75rem; animation: float 3s infinite ease-in-out; }

.vortex-meter {
    position: absolute;
    top: -5px; left: -5px;
    width: 100px; height: 100px;
    transform: rotate(-90deg);
}

.v-bg { fill: none; stroke: rgba(255,255,255,0.03); stroke-width: 4; }
.v-fill {
    fill: none;
    stroke: #0ea5e9;
    stroke-width: 4;
    stroke-dasharray: 289;
    stroke-dashoffset: 289;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.5s;
}

.terminal-pnl { flex: 1; }
.t-label { font-size: 0.55rem; font-weight: 900; color: #38bdf8; letter-spacing: 2.5px; margin-bottom: 0.25rem; }
.t-pnl-main { display: flex; align-items: baseline; gap: 0.5rem; }
#hudPnL { font-size: 1.8rem; font-weight: 900; font-family: var(--apex-mono); color: #f8fafc; }
.t-trend { width: 10px; height: 10px; border-radius: 50%; background: #334155; transition: 0.4s; }
.t-trend.up { background: #10b981; box-shadow: 0 0 15px rgba(16, 185, 129, 0.5); clip-path: polygon(50% 0%, 0% 100%, 100% 100%); width: 12px; height: 12px; }
.t-trend.down { background: #f43f5e; box-shadow: 0 0 15px rgba(244, 63, 94, 0.5); clip-path: polygon(50% 100%, 0% 0%, 100% 0%); width: 12px; height: 12px; }
.t-sub { font-size: 0.55rem; font-weight: 700; color: rgba(255,255,255,0.2); margin-top: 0.5rem; letter-spacing: 1px; }

/* 📈 Metrics Vortex: Data Bricks */
.metrics-vortex {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
    position: relative;
    z-index: 1;
}

.v-brick {
    background: rgba(15, 23, 42, 0.6);
    padding: 1.1rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.3s var(--apex-ease);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.v-brick:hover { 
    background: rgba(15, 23, 42, 0.9); 
    border-color: rgba(14, 165, 233, 0.2); 
    transform: translateY(-3px); 
    z-index: 10; 
}
.brick-wide { grid-column: span 2; }
.brick-accent { background: rgba(14, 165, 233, 0.05); border-color: rgba(14, 165, 233, 0.1); }

.b-label { font-size: 0.55rem; font-weight: 800; color: #64748b; letter-spacing: 1.5px; text-transform: uppercase; }
.b-value { font-size: 1.15rem; font-weight: 900; font-family: var(--apex-mono); color: #f8fafc; }

.b-header { display: flex; justify-content: space-between; align-items: center; }
.b-tag { font-size: 0.5rem; font-weight: 900; background: #0ea5e9; color: #020617; padding: 2px 8px; border-radius: 4px; }

/* 📡 Cockpit Instrumentation: Radar */
.cockpit-instrumentation {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
}

.instr-header { display: flex; justify-content: space-between; align-items: center; }
.instr-title { font-size: 0.6rem; font-weight: 900; color: #0ea5e9; letter-spacing: 2.5px; }
.instr-status { font-size: 0.55rem; font-weight: 800; color: #10b981; font-family: var(--apex-mono); opacity: 0.6; }

.radar-scope {
    height: 70px;
    background: #020617;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.radar-grid {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: 
        linear-gradient(rgba(14, 165, 233, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(14, 165, 233, 0.04) 1px, transparent 1px);
    background-size: 20px 100%;
}

.radar-sweep {
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(14, 165, 233, 0.08), transparent);
    animation: radarSweep 5s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

.radar-assets { position: absolute; top: 50%; left: 5%; width: 90%; height: 6px; transform: translateY(-50%); background: rgba(255,255,255,0.03); border-radius: 10px; }

.r-zone { position: absolute; height: 100%; border-radius: 2px; transition: 0.6s var(--apex-ease); }
.r-zone.risk { background: linear-gradient(90deg, transparent, rgba(244, 63, 94, 0.3)); border-left: 2px solid #f43f5e; box-shadow: -5px 0 15px rgba(244, 63, 94, 0.2); }
.r-zone.target { background: linear-gradient(90deg, rgba(16, 185, 129, 0.3), transparent); border-right: 2px solid #10b981; box-shadow: 5px 0 15px rgba(16, 185, 129, 0.2); }

.r-marker { position: absolute; top: -10px; width: 3px; height: calc(100% + 20px); z-index: 10; transition: left 0.6s var(--apex-ease); }
.r-marker.entry { background: #0ea5e9; box-shadow: 0 0 15px #0ea5e9; }
.r-marker.stop { background: #f43f5e; opacity: 0.6; width: 2px; }
.r-marker.target { background: #10b981; opacity: 0.6; width: 2px; }

.radar-readouts { display: flex; justify-content: space-between; }
.r-item { font-size: 0.6rem; font-weight: 800; color: #475569; font-family: var(--apex-mono); }
.r-item span:last-child { color: #f1f5f9; margin-left: 0.25rem; }

/* 📟 Meta Terminal */
.meta-terminal {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.25rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.meta-line { display: flex; justify-content: space-between; align-items: center; }
.l-tag { font-size: 0.55rem; font-weight: 900; color: #475569; letter-spacing: 2px; }
.l-val { font-size: 0.65rem; font-weight: 800; color: #94a3b8; font-family: var(--apex-mono); }

/* 🛸 Universal Animations */
@keyframes ringRotateCW { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes ringRotateCCW { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }
@keyframes radarSweep { 0% { left: -100%; } 100% { left: 100%; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes emojiBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* 📱 Responsive Overrides (Cobalt Shift) */
@media (max-width: 1024px) {
    .apex-telemetry.cobalt-console { width: 100%; height: auto; border-left: none; border-top: 1px solid rgba(0, 242, 255, 0.1); }
    .command-deck { flex-direction: row; padding: 1.5rem; height: 180px; gap: 1.5rem; overflow-x: auto; overflow-y: hidden; }
    .widget-hub { min-width: 320px; }
    .metrics-vortex { display: flex; gap: 1rem; }
    .v-brick { min-width: 140px; }
    .brick-wide { min-width: 240px; }
    .cockpit-instrumentation { min-width: 320px; }
    .meta-terminal { display: none; }
}

/* --- Zenith Command Tooltip: v4.0 --- */
.v-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    right: 0;
    width: 280px;
    background: #080c14 !important; /* Solid Obsidian */
    border: 1px solid rgba(14, 165, 233, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(14, 165, 233, 0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    animation: tooltipSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto; /* Allow interaction */
}

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

.v-tooltip .data-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    font-family: var(--apex-mono);
    color: rgba(255, 255, 255, 0.4);
}

.v-tooltip .data-line span { color: #fff; font-weight: 700; }

.v-tooltip .matched-rule {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #38bdf8 !important;
    font-weight: 800;
}

.v-tooltip .total {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #38bdf8 !important;
    font-weight: 900;
    font-size: 0.75rem;
}

.v-tooltip .flow-header {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
}

.v-tooltip .flow-item { opacity: 0.6; font-size: 0.6rem; }

/* Position Overrides for JS Engine */
.v-tooltip.pos-down { top: calc(100% + 15px); bottom: auto; }
.v-tooltip.pos-left { right: calc(100% + 15px); bottom: 0; }
.v-tooltip.pos-right { left: calc(100% + 15px); bottom: 0; right: auto; }

.sync-status {
    width: 6px;
    height: 6px;
    background: var(--apex-accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--apex-accent);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* --- Market Ticker --- */
.apex-market-ticker {
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--apex-border);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.ticker-content {
    display: flex;
    gap: 3rem;
    white-space: nowrap;
    animation: tickerScroll 30s infinite linear;
    padding-left: 100%;
}

.ticker-content span {
    font-size: 0.65rem;
    font-family: var(--apex-mono);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    gap: 0.5rem;
}

.ticker-content span i {
    font-style: normal;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-200%); }
}

.btn-apex-action-add {
    width: 100%;
    margin-top: 1rem;
    padding: 2px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.1), transparent);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--apex-ease);
    border-radius: 12px;
}

/* --- Apex Footer --- */
.apex-footer {
    height: 90px;
    padding: 0 3rem;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--apex-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.action-add-inner {
    background: var(--apex-surface);
    border: 1px dashed rgba(var(--primary-rgb), 0.3);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--apex-accent);
    font-family: var(--apex-mono);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.3s;
}

.btn-apex-action-add:hover {
    background: linear-gradient(90deg, transparent, var(--apex-accent), transparent);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.15);
}

.btn-apex-action-add:hover .action-add-inner {
    background: rgba(var(--primary-rgb), 0.05);
    border-color: var(--apex-accent);
    color: #fff;
}

.btn-icon-exit-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 82, 82, 0.05);
    border: 1px solid rgba(255, 82, 82, 0.1);
    color: #ff5252;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-icon-exit-remove:hover {
    background: #ff5252;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 82, 82, 0.4);
    transform: rotate(90deg);
}

.pe-header .chevron {
    transition: transform 0.3s var(--apex-ease);
}

.partial-exit-card.collapsed .pe-header .chevron {
    transform: rotate(-90deg);
}

.btn-apex-primary {
    background: var(--apex-accent) !important;
    color: #000 !important;
    border: none !important;
    border-radius: 16px !important;
    padding: 1rem 2.5rem !important;
    font-weight: 800 !important;
    font-size: 1rem !important;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 10px 30px var(--apex-accent-glow) !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-apex-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px var(--apex-accent-glow) !important;
}

.btn-apex-secondary {
    background: var(--apex-glass) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    padding: 1rem 2rem !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: 0.3s;
}

.btn-apex-secondary:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* --- Mode Switch --- */
.apex-mode-nexus {
    display: flex;
    padding: 4px;
    background: var(--apex-glass);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
}

.apex-mode-nexus button {
    flex: 1;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
}

.apex-mode-nexus button.active {
    background: var(--apex-accent);
    color: #000;
}

/* --- Transitions & Micro-states --- */
.exit-gate {
    margin-top: 1.5rem;
    animation: apexSlideDown 0.4s var(--apex-ease);
}

@keyframes apexSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.emotion-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.apex-badge {
    background: var(--apex-glass);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.apex-badge.active {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--apex-accent);
    color: var(--apex-accent);
}

/* ==========================================================================
   MOBILE & RESPONSIVE OPTIMIZATIONS (THE APEX)
   ========================================================================== */

@media (max-width: 1200px) {
    .apex-telemetry { width: 340px; padding: 2rem; }
}

@media (max-width: 1024px) {
    .apex-interface { max-width: 100% !important; border-radius: 0; height: 100%; }
    .apex-body { height: 100%; max-height: 100dvh; flex-direction: column; }
    .apex-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
    
    .apex-telemetry { 
        width: 100%; 
        height: auto;
        padding: 1rem; 
        border-right: none; 
        border-bottom: 1px solid var(--apex-border); 
        order: -1; 
        flex-shrink: 0;
        mask-image: none;
    }

    .hud-deck-container {
        flex-direction: row;
        gap: 1.5rem;
        align-items: center;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .intelligence-nexus {
        padding: 0.75rem 1rem;
        flex-direction: row;
        gap: 1rem;
        width: auto;
        min-width: fit-content;
        border-radius: 12px;
    }

    .quantum-orb-module {
        width: 40px;
        height: 40px;
    }

    .quantum-orb {
        width: 100%;
        height: 100%;
    }

    .orb-scanner { display: none; }
    .orb-core { width: 25px; height: 25px; }

    #hudPnL { font-size: 1.25rem; }
    .telemetry-label { display: none; }

    .telemetry-grid {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
    }

    .h-cell {
        min-width: 110px;
        padding: 0.75rem;
    }

    .h-cell--wide { grid-column: auto; }
    .h-value { font-size: 1rem; }

    .tactical-scope, .logic-processor { display: none; } /* Hide complex visualizers in top bar scroll */
}

@media (max-width: 768px) {
    .apex-nav {
        width: 100%;
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--apex-border);
    }
    .apex-brand { margin-bottom: 0; }
    .brand-info { display: none; }
    .apex-nav-list { flex-direction: row; justify-content: space-around; gap: 0.5rem; }
    .apex-nav-item { padding: 0.75rem; gap: 0; flex: 1; justify-content: center; }
    .apex-nav-item .nav-icon { width: 20px; height: 20px; opacity: 0.6; }
    .apex-nav-item.active { flex: 2; gap: 0.5rem; }
    .apex-nav-item.active span { display: block; font-size: 0.7rem; }
    .apex-nav-item span { display: none; }

    .apex-header { height: 70px; padding: 0 1.5rem; }
    .apex-workspace { padding: 1.5rem; border-right: none; }
    
    .apex-footer { 
        height: auto; 
        padding: 1.5rem; 
        flex-direction: column-reverse; 
        gap: 1rem; 
    }
    .apex-footer .btn-apex-primary, 
    .apex-footer .btn-apex-secondary { 
        width: 100%; 
        justify-content: center; 
        padding: 1.2rem !important;
    }
}

/* Scroll Customization for HUD Deck */
.hud-deck-container::-webkit-scrollbar { height: 2px; }
.hud-deck-container::-webkit-scrollbar-track { background: transparent; }
.hud-deck-container::-webkit-scrollbar-thumb { background: var(--apex-border); }

.apex-telemetry::-webkit-scrollbar { display: none; }


/* ==========================================================================
   ZENITH NEXUS STATEMENTS - HIGH-FIDELITY INTELLIGENCE GRID
   ========================================================================== */

:root {
    --nexus-bg: rgba(10, 11, 14, 0.95);
    --nexus-card-bg: rgba(25, 27, 34, 0.5);
    --nexus-border: rgba(255, 255, 255, 0.08);
    --nexus-accent: #6366f1;
    --nexus-success: #10b981;
    --nexus-danger: #ef4444;
    --nexus-warning: #f59e0b;
    --nexus-glow-s: rgba(16, 185, 129, 0.15);
    --nexus-glow-d: rgba(239, 68, 68, 0.15);
}

.nexus-statement-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
    animation: nexusFadeIn 0.5s ease-out;
}

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

/* --- Filter Deck --- */
.nexus-filter-deck {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--nexus-card-bg);
    border: 1px solid var(--nexus-border);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.nexus-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.nexus-filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.25rem;
}

.nexus-filter-deck input, 
.nexus-filter-deck select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--nexus-border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nexus-filter-deck input:focus, 
.nexus-filter-deck select:focus {
    outline: none;
    border-color: var(--nexus-accent);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: rgba(0, 0, 0, 0.5);
}

/* --- Intelligence Grid --- */
.nexus-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nexus-entry-card {
    display: flex;
    flex-direction: column;
    background: var(--nexus-card-bg);
    border: 1px solid var(--nexus-border);
    border-radius: 14px;
    transition: all 0.3s var(--apex-ease);
    overflow: hidden;
    position: relative;
    cursor: default;
}

.nexus-entry-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--line-color, var(--nexus-accent));
    opacity: 0.6;
}

.nexus-entry-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(35, 38, 48, 0.6);
    transform: translateX(4px);
}

/* Main Row */
.nexus-main-row {
    display: grid;
    grid-template-columns: 80px 1fr 140px 120px 100px 120px 80px;
    align-items: center;
    padding: 1.25rem 1.5rem;
    gap: 1.5rem;
}

.n-id { color: rgba(255, 255, 255, 0.3); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

.n-symbol-block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.n-symbol { font-size: 1.1rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.n-market { font-size: 0.75rem; color: rgba(255, 255, 255, 0.4); text-transform: uppercase; }

.n-side-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.05);
}

.n-side-long { color: var(--nexus-success); border: 1px solid rgba(16, 185, 129, 0.2); }
.n-side-short { color: var(--nexus-danger); border: 1px solid rgba(239, 68, 68, 0.2); }

.n-performance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.n-pnl { font-size: 1.1rem; font-weight: 700; }
.n-pnl.positive { color: var(--nexus-success); text-shadow: 0 0 15px var(--nexus-glow-s); }
.n-pnl.negative { color: var(--nexus-danger); text-shadow: 0 0 15px var(--nexus-glow-d); }

.n-pnl-percent { font-size: 0.8rem; font-weight: 600; opacity: 0.8; }

.n-status-pill {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--nexus-border);
    text-align: center;
}

.n-status-open { color: var(--nexus-warning); border-color: rgba(245, 158, 11, 0.3); }
.n-status-closed { color: var(--nexus-success); border-color: rgba(16, 185, 129, 0.3); }
.n-status-partial { color: var(--nexus-accent); border-color: rgba(99, 102, 241, 0.3); }

.n-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.n-btn-expand {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.2s;
}

.n-btn-expand:hover { color: #fff; transform: scale(1.1); }

/* --- Expansion Panel --- */
.nexus-detail-panel {
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid transparent;
}

.nexus-entry-card.expanded {
    background: rgba(30, 32, 42, 0.9);
    border-color: rgba(99, 102, 241, 0.3);
}

.nexus-entry-card.expanded .nexus-detail-panel {
    max-height: 800px;
    border-top-color: var(--nexus-border);
    padding: 2rem;
}

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

.detail-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-group h5 {
    font-size: 0.75rem;
    color: var(--nexus-accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.detail-label { font-size: 0.75rem; color: rgba(255, 255, 255, 0.4); }
.detail-value { font-size: 0.9rem; font-weight: 600; color: #fff; }

.remarks-box {
    grid-column: 1 / -1;
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.remarks-box p { font-size: 0.95rem; color: rgba(255, 255, 255, 0.7); line-height: 1.6; }

.emotion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.emotion-tag {
    padding: 0.3rem 0.7rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--nexus-accent);
}

/* Pagination Control */
.nexus-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--nexus-card-bg);
    border: 1px solid var(--nexus-border);
    border-radius: 16px;
    margin-top: 1rem;
}

.n-page-info { font-size: 0.85rem; color: rgba(255, 255, 255, 0.5); }

.n-pagination-btns { display: flex; gap: 0.75rem; }

.n-btn-pagi {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--nexus-border);
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.n-btn-pagi:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }
.n-btn-pagi:disabled { opacity: 0.3; cursor: not-allowed; }

@media (max-width: 1100px) {
    .nexus-main-row {
        grid-template-columns: 1fr 120px 100px 120px 60px;
    }
    .n-id, .n-market { display: none; }
}

@media (max-width: 768px) {
    .nexus-main-row {
        grid-template-columns: 1fr 100px 50px;
        gap: 1rem;
    }
    .n-status-pill, .n-side-badge { display: none; }
    .nexus-detail-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   ACCOUNTS SYSTEM - EQUITY & QUANTUM LEDGER
   ========================================================================== */

.accounts-config-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0.5rem;
    animation: nexusFadeIn 0.6s ease-out;
}

/* Equity HUD */
.equity-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.equity-stat-card {
    background: var(--nexus-card-bg);
    border: 1px solid var(--nexus-border);
    border-radius: 20px;
    padding: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.equity-stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.equity-stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at center, var(--card-accent, var(--nexus-accent)), transparent 70%);
    opacity: 0.05;
    pointer-events: none;
}

.equity-stat-card.primary { --card-accent: var(--nexus-accent); }
.equity-stat-card.warning { --card-accent: var(--nexus-warning); }
.equity-stat-card.success { --card-accent: var(--nexus-success); }

.equity-stat-card .stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.equity-stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
}

.equity-stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    margin: 0;
}

.equity-stat-card .stat-sub {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    margin: 0;
}

.equity-stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

/* Action Layout */
.accounts-action-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .accounts-action-layout { grid-template-columns: 1fr; }
}

.accounts-funding-panel, .accounts-allocation-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--nexus-border);
    border-radius: 20px;
    padding: 2rem;
}

.funding-actions, .allocation-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.funding-input-group {
    display: flex;
    gap: 1rem;
}

.funding-input-group input, .funding-input-group select {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    padding: 1rem;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.funding-input-group input:focus {
    border-color: var(--nexus-accent);
    background: rgba(0, 0, 0, 0.5);
    outline: none;
}

.funding-btn-row {
    display: flex;
    gap: 1rem;
}

.funding-btn-row .btn {
    flex: 1;
    padding: 1rem;
    font-weight: 700;
    border-radius: 12px;
}

/* Allocation List */
.allocation-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.allocation-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alloc-name { font-weight: 600; color: #fff; }
.alloc-values { display: flex; gap: 1.5rem; align-items: center; }
.alloc-stat { display: flex; flex-direction: column; align-items: flex-end; }
.alloc-stat .label { font-size: 0.65rem; text-transform: uppercase; color: rgba(255,255,255,0.4); }
.alloc-stat .val { font-size: 0.9rem; font-weight: 700; color: var(--nexus-accent); }
.alloc-stat .val.used { color: var(--nexus-warning); }

/* Quantum Ledger Entries */
.n-tx-type {
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
}

.tx-deposit { color: var(--nexus-success); background: rgba(16, 185, 129, 0.1); }
.tx-withdraw { color: var(--nexus-danger); background: rgba(239, 68, 68, 0.1); }
.tx-allocate { color: var(--nexus-accent); background: rgba(99, 102, 241, 0.1); }
.tx-lock { color: var(--nexus-warning); background: rgba(245, 158, 11, 0.1); }
.tx-release { color: #8b5cf6; background: rgba(139, 92, 246, 0.1); }
.tx-pnl { color: #fff; background: rgba(255, 255, 255, 0.05); }

.n-amount { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 1rem; }
.n-amount.positive { color: var(--nexus-success); }
.n-amount.negative { color: var(--nexus-danger); }

.n-desc { font-size: 0.85rem; color: rgba(255, 255, 255, 0.6); }
.n-time { font-size: 0.75rem; color: rgba(255, 255, 255, 0.3); }

/* Metrics Brick Variations */
.v-brick.brick-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}
.v-brick.brick-danger .b-label { color: #ef4444 !important; }
.v-brick.brick-danger .b-value { color: #ff8080 !important; text-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }

.allocation-btn-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.n-tx-type.tx-release {
    background: rgba(255, 170, 0, 0.1);
    color: #ffaa00;
}
.n-tx-type.tx-allocate {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
}

/* --- Quantum Ledger Styles (Premium Redesign) --- */
.nexus-entry-card.quantum-tx {
    border-left: 4px solid var(--line-color, var(--nexus-accent)) !important;
}

.quantum-tx .n-tx-tag {
    display: flex;
    align-items: center;
}

.quantum-tx .n-tx-type {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.n-tx-type.tx-deposit { color: var(--nexus-success); border-color: rgba(16, 185, 129, 0.3); --line-color: var(--nexus-success); }
.n-tx-type.tx-withdraw { color: var(--nexus-danger); border-color: rgba(239, 68, 68, 0.3); --line-color: var(--nexus-danger); }
.n-tx-type.tx-allocate { color: var(--nexus-accent); border-color: rgba(99, 102, 241, 0.3); --line-color: var(--nexus-accent); }
.n-tx-type.tx-release { color: var(--nexus-warning); border-color: rgba(245, 158, 11, 0.3); --line-color: var(--nexus-warning); }
.n-tx-type.tx-lock { color: #60a5fa; border-color: rgba(96, 165, 250, 0.3); --line-color: #60a5fa; }
.n-tx-type.tx-pnl { color: var(--nexus-success); border-color: rgba(16, 185, 129, 0.3); --line-color: var(--nexus-success); }
.n-tx-type.tx-charges { color: var(--nexus-danger); border-color: rgba(239, 68, 68, 0.3); --line-color: var(--nexus-danger); }
.n-tx-type.tx-transfer_in { color: #a855f7; border-color: rgba(168, 85, 247, 0.3); --line-color: #a855f7; }
.n-tx-type.tx-transfer_out { color: #f472b6; border-color: rgba(244, 114, 182, 0.3); --line-color: #f472b6; }

.quantum-tx .n-amount.positive { color: var(--nexus-success); font-weight: 700; text-shadow: 0 0 10px rgba(16, 185, 129, 0.2); }
.quantum-tx .n-amount.negative { color: var(--nexus-danger); font-weight: 700; text-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }

.mini-ledger {
    background: rgba(0, 0, 0, 0.15) !important;
    border-radius: 16px !important;
    border: 1px solid var(--nexus-border) !important;
    overflow: hidden;
}

.mini-ledger .nexus-grid {
    max-height: 440px;
    overflow-y: auto;
    padding: 1.25rem;
    gap: 0.6rem;
}

.mini-ledger .nexus-grid::-webkit-scrollbar {
    width: 4px;
}

.mini-ledger .nexus-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.mini-ledger .nexus-main-row {
    padding: 0.85rem 1.25rem;
    grid-template-columns: 110px 100px 1fr 140px 160px !important;
    gap: 1rem;
}

.mini-ledger .n-desc { font-size: 0.85rem; font-weight: 500; }
.mini-ledger .n-time { font-size: 0.75rem; opacity: 0.5; font-family: 'JetBrains Mono', monospace; }

.nexus-entry-card.quantum-tx:hover {
    background: rgba(255, 255, 255, 0.02);
    transform: translateX(2px);
}

/* --- Statement Phase Headers --- */
.nexus-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.phase-title-block {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.phase-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.nexus-filter-deck.mini {
    padding: 0.75rem;
    gap: 0.75rem;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    min-width: 500px;
}

.nexus-filter-deck.mini input,
.nexus-filter-deck.mini select {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

/* Live Pulse Badge */
.live-pulse-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 50px;
    color: var(--nexus-success);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--nexus-success);
    border-radius: 50%;
    position: relative;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.n-tx-type.tx-summary { color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); --line-color: #38bdf8; }

/* Transaction PIN Styles */
.pin-box {
    width: 60px;
    height: 70px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--nexus-border);
    border-radius: 14px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--nexus-accent);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-box:focus {
    border-color: var(--nexus-accent);
    background: rgba(99, 102, 241, 0.08);
    outline: none;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

#pinStatusIndicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}
#pinStatusIndicator.enabled { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
#pinStatusIndicator.disabled { background: #f43f5e; box-shadow: 0 0 8px rgba(244, 63, 94, 0.5); }

/* Others Configuration Tab */
.others-config-container {
    padding: 1rem 0;
    max-width: 800px;
}

.currency-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.currency-settings-grid .full-width {
    grid-column: span 2;
}

.input-with-icon {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2px 12px;
    transition: all 0.3s ease;
}

.input-with-icon:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-with-icon input {
    background: transparent;
    border: none;
    flex: 1;
    padding: 0.75rem 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.input-with-icon input:focus {
    outline: none;
}

.input-with-icon .prefix-text,
.input-with-icon .suffix-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}

.input-with-icon .prefix-text {
    padding-right: 8px;
    border-right: 1px solid var(--border);
    margin-right: 4px;
}

.input-with-icon .suffix-text {
    padding-left: 8px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
}

.config-section-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.config-section-card .section-header {
    padding: 1.5rem;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.05), transparent);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.config-section-card .section-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.config-section-card .section-icon svg {
    width: 24px;
    height: 24px;
}

.config-section-card .section-info h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.config-section-card .section-info p {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.config-section-card .section-body {
    padding: 2rem;
}

.config-section-card .section-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
}

@media (max-width: 600px) {
    .currency-settings-grid {
        grid-template-columns: 1fr;
    }
    .currency-settings-grid .full-width {
        grid-column: span 1;
    }
}

/* Nexus Treasury Command Hub */
.nexus-treasury-hub {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    position: relative;
    max-width: 900px;
    margin: 1rem auto;
}

.nexus-treasury-hub::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.03) 0%, transparent 70%);
    pointer-events: none;
}

.hub-header.luxury-header {
    padding: 2rem 2.5rem;
    background: transparent;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.luxury-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    opacity: 0.3;
}

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

.icon-orb {
    width: 56px;
    height: 56px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.orb-glow {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), transparent);
    opacity: 0.2;
    filter: blur(8px);
    animation: orbRotate 10s linear infinite;
}

@keyframes orbRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.engine-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    background: linear-gradient(to bottom, #fff, #999);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.engine-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}


.scan-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

.scan-text {
    font-size: 0.75rem;
    font-weight: 800;
    color: #10b981;
    letter-spacing: 0.05em;
}

.scan-line {
    position: absolute;
    top: 0;
    left: -50%;
    width: 30%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(16, 185, 129, 0.2), transparent);
    transform: skewX(-25deg);
    animation: scanMove 3s infinite;
}

@keyframes scanMove {
    0% { left: -50%; }
    100% { left: 150%; }
}


.pulsar {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    position: relative;
}

.pulsar::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: pulseSync 2s infinite;
}

@keyframes pulseSync {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.5); opacity: 0; }
}

.hub-content {
    padding: 2.5rem;
}

.nexus-node-grid {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.nexus-node {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.nexus-node:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
    transform: translateY(-5px);
}

.node-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.1em;
    margin-bottom: 1.25rem;
    opacity: 0.8;
}

.node-tag.sec {
    color: #8b5cf6;
}

.node-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.node-symbol {
    width: 60px;
    height: 60px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.node-symbol.sec {
    color: #8b5cf6;
}

.node-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.n-field label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.n-field input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 4px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.n-field input:focus {
    outline: none;
    border-color: var(--primary);
}

.node-footer {
    margin-top: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.nexus-bridge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bridge-arm {
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, var(--border), rgba(99, 102, 241, 0.5), var(--border));
}

.bridge-toggle {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.bridge-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

/* Formula Deck */
.nexus-equation-deck {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
}

.deck-title {
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.equation-view {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

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

.e-val {
    font-size: 2rem;
    font-weight: 200;
    color: var(--text-muted);
}

.e-symbol {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.e-code {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 4px 8px;
    border-radius: 6px;
}

.operator {
    width: 60px;
    height: 2px;
    background: var(--border);
    position: relative;
}

.pulse-line {
    position: absolute;
    inset: 0;
    background: var(--primary);
    animation: flowLine 2s infinite;
}

@keyframes flowLine {
    0% { transform: scaleX(0); transform-origin: left; opacity: 0; }
    50% { transform: scaleX(1); transform-origin: left; opacity: 1; }
    51% { transform: scaleX(1); transform-origin: right; opacity: 1; }
    100% { transform: scaleX(0); transform-origin: right; opacity: 0; }
}

.entry.target {
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.entry.target:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.1);
    transform: scale(1.05);
}

.entry.target input {
    background: transparent;
    border: none;
    width: 160px;
    text-align: center;
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--text-primary);
}

.entry.target input:focus {
    outline: none;
}

.eq-hint {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.hub-footer {
    padding: 2rem 2.5rem;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
}

.nexus-save-btn {
    width: 100%;
    max-width: 400px;
    height: 54px;
    background: linear-gradient(135deg, var(--primary), #4338ca);
    border: none;
    border-radius: 14px;
    color: white;
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-glow-container {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255, 255, 255, 0.4), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.nexus-save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.nexus-save-btn:hover .btn-glow-container {
    opacity: 1;
}

@media (max-width: 800px) {
    .nexus-node-grid {
        flex-direction: column;
    }
    .nexus-bridge {
        transform: rotate(90deg);
        margin: 1rem 0;
    }
    .equation-view {
        flex-direction: column;
        gap: 1rem;
    }
    .operator {
        transform: rotate(90deg);
    }
}




/* Nexus Currency Input Components */
.nexus-currency-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: visible; /* Changed from hidden to allow tooltip visibility */
    transition: all 0.3s ease;
}

.nexus-currency-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.currency-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    background: rgba(99, 102, 241, 0.08);
    border-right: 1px solid var(--border);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
    color: var(--primary);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.currency-indicator:hover {
    background: rgba(99, 102, 241, 0.15);
}

.nexus-currency-input-group input {
    background: transparent !important;
    border: none !important;
    flex: 1;
    padding: 0.75rem 1rem !important;
    box-shadow: none !important;
}

.currency-conversion-preview {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background: #0f172a; /* Solid background for visibility */
    border: 1.5px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 800;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 99999; /* Max z-index for visibility */
    box-shadow: 0 10px 40px rgba(0,0,0,0.6), 0 0 15px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
}

.currency-conversion-preview::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--primary);
}

/* Tooltip activation logic */
.nexus-currency-input-group:hover .currency-conversion-preview.active,
.nexus-currency-input-group:focus-within .currency-conversion-preview.active,
.apex-input-field:hover .currency-conversion-preview.active,
.apex-input-field:focus-within .currency-conversion-preview.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

/* Fix clipping in Apex Phase Containers */
.apex-phase, .apex-input-field, .nexus-currency-input-group {
    overflow: visible !important;
}

.apex-main {
    overflow: visible !important;
}

/* Discipline Manifest UI */
.discipline-rules-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.discipline-rule-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: slideInRight 0.3s ease-out;
}

.discipline-rule-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    opacity: 0.6;
}

.discipline-rule-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    background: var(--bg-elevated);
}

.discipline-rule-number {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    opacity: 0.8;
    background: rgba(99, 102, 241, 0.1);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.discipline-rule-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.5;
}

.discipline-rule-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    opacity: 0;
}

.discipline-rule-item:hover .discipline-rule-delete {
    opacity: 1;
}

.discipline-rule-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.empty-discipline-state {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-input);
    border: 2px dashed var(--border);
    border-radius: 16px;
    color: var(--text-muted);
}

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

/* ==================== BACKUP & RESTORE ==================== */
.backup-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2.5rem;
    padding: 1rem;
}

.backup-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.backup-section .section-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.backup-section .section-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--nexus-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.backup-section.restore .section-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--nexus-danger);
}

.backup-section .section-title h3 {
    margin: 0;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
}

.backup-section .section-title p {
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
    opacity: 0.6;
}

.backup-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--nexus-border);
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: all 0.3s ease;
}

.backup-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.backup-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.backup-info .info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

.backup-info .info-item .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--nexus-accent);
    box-shadow: 0 0 10px var(--nexus-accent);
}

.google-sheet-settings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.google-sheet-settings .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.google-sheet-settings label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.google-sheet-settings input {
    background: rgba(15, 15, 20, 0.6);
    border: 1px solid var(--nexus-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.google-sheet-settings input:focus {
    border-color: var(--nexus-accent);
    background: rgba(99, 102, 241, 0.05);
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.google-sheet-settings .help-text {
    font-size: 0.8rem;
    opacity: 0.5;
    font-style: italic;
}

.restore-warning {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.restore-warning svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--nexus-danger);
}

.restore-warning p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

.backup-section.restore .backup-card:hover {
    border-color: rgba(239, 68, 68, 0.3);
}

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

/* Discipline Rule Card Redesign */
.discipline-rule-item {
    cursor: pointer;
    display: flex;
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: space-between;
    gap: 1rem;
}

.discipline-rule-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.discipline-rule-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.discipline-rule-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex: 1;
}

.discipline-rule-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.discipline-rule-desc {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: left;
}

/* Badges for Rule Type */
.discipline-rule-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
}

/* Type Badges */
.badge-type-psychology {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.badge-type-risk {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.badge-type-money {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge-type-life {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.badge-type-execution {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Frequency Badges */
.badge-freq-daily {
    background: rgba(6, 182, 212, 0.1);
    color: #22d3ee;
    border: 1px solid rgba(6, 182, 212, 0.2);
}
.badge-freq-weekly {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-freq-monthly {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}
.badge-freq-quarterly {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-freq-yearly {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Grouping Structure for Discipline Manifest */
.discipline-type-section {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.discipline-type-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.discipline-type-header:hover {
    opacity: 0.85;
}

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

.discipline-type-header-left svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.discipline-type-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.discipline-chevron {
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.discipline-type-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.discipline-type-section.collapsed {
    gap: 0;
    padding-bottom: 0.75rem;
}

.discipline-type-section.collapsed .discipline-type-header {
    border-bottom-color: transparent;
    padding-bottom: 0;
}

.discipline-type-section.collapsed .discipline-type-body {
    display: none;
}

.discipline-type-section.collapsed .discipline-chevron {
    transform: rotate(-90deg);
}

/* Colors for specific groups */
.group-psychology .discipline-type-header {
    color: #a78bfa;
}
.group-risk .discipline-type-header {
    color: #f87171;
}
.group-money .discipline-type-header {
    color: #34d399;
}
.group-life .discipline-type-header {
    color: #fbbf24;
}
.group-execution .discipline-type-header {
    color: #60a5fa;
}

/* Frequency Subsection */
.discipline-freq-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.discipline-freq-header {
    margin: 0 0 0.25rem 0;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.4;
    text-align: left;
}

.discipline-rules-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 992px) {
    .discipline-rules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Template Rules Modal Custom Styles */
.template-group-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.template-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: left;
}

.template-rule-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.template-rule-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.template-rule-row.selected {
    background: rgba(167, 139, 250, 0.04);
    border-color: rgba(167, 139, 250, 0.25);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.05);
}

.template-rule-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
}

.template-rule-checkbox {
    width: 17px;
    height: 17px;
    accent-color: #a78bfa;
    cursor: pointer;
    margin: 0;
}

.template-rule-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.template-rule-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.template-rule-name-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.template-rule-desc-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.template-rule-freq-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.8;
}

/* Daily Discipline Log Modal Styles */
.discipline-log-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.discipline-log-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.discipline-log-info {
    flex: 1;
    text-align: left;
}

.discipline-log-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.15rem 0;
}

.discipline-log-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.discipline-log-options {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    gap: 0.15rem;
}

.discipline-log-option {
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.discipline-log-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.discipline-log-option span {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    user-select: none;
}

/* Yes Checked */
.discipline-log-option.yes input:checked + span {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* No Checked */
.discipline-log-option.no input:checked + span {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* NA Checked */
.discipline-log-option.na input:checked + span {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Week Navigation Header */
.discipline-week-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.25rem;
}

.week-nav-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.week-nav-btn {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.week-nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

/* Week Picker layout & circle styles */
.discipline-week-picker-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.weekday-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.weekday-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.weekday-circle:hover:not(.upcoming) {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.weekday-circle.selected {
    border-color: #a78bfa !important; /* Purple active border */
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.4);
    transform: scale(1.1);
}

/* Today style: yellow accent outline and indicator */
.weekday-circle.today {
    border: 2px solid #eab308 !important; /* Yellow/Amber border */
    color: #eab308 !important;
}

.weekday-circle.today::after {
    content: '';
    position: absolute;
    bottom: -3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #eab308;
}

.week-picker-separator {
    width: 1px;
    height: 28px;
    background: var(--border);
    margin: 0 0.5rem;
    align-self: center;
    opacity: 0.3;
}

/* Filled state: green ring border */
.weekday-circle.filled {
    color: #34d399 !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

/* Unfilled state: red ring border */
.weekday-circle.unfilled {
    color: #f87171 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.weekday-circle:not(.upcoming)::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border-radius: 50%;
    background: var(--bg-card); /* solid inner circle */
    z-index: 1;
}

.weekday-circle span {
    position: relative;
    z-index: 2;
    color: var(--text-primary);
}

/* Upcoming state: greyed out */
.weekday-circle.upcoming {
    background: rgba(255, 255, 255, 0.02) !important;
    color: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    border-style: dashed !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Weekly Circle Styling */
.weekday-circle.weekly-circle {
    border-color: rgba(167, 139, 250, 0.2);
    color: #a78bfa;
}

.weekday-circle.weekly-circle:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: #a78bfa;
}

.weekday-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Auto Calculated Rules Styles */
.discipline-auto-section-title {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.discipline-auto-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.discipline-auto-badge.followed {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.discipline-auto-badge.broken {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.discipline-auto-badge.na {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Auto Rule Config Modal - Portfolio Checkboxes */
.auto-rule-portfolio-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.15s ease;
    user-select: none;
}

.auto-rule-portfolio-option:hover {
    background: rgba(234, 179, 8, 0.07);
    border-color: rgba(234, 179, 8, 0.25);
}

.auto-rule-portfolio-option input[type="checkbox"] {
    accent-color: #eab308;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.auto-rule-portfolio-option span {
    font-weight: 500;
}

