/* ===========================================================================
   EXECUTION + POSITIONS - Combined Panel Layout
   =========================================================================== */
.exec-positions-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

/* Left column: order form */
.order-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: sticky;
    top: 0;
}

/* Right column: positions/orders tables */
.positions-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* Account selector row (inside execution panel only) */
.acct-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    background: var(--elevated);
    border: 1px solid var(--border-md);
    border-radius: var(--r-md);
    padding: 10px 14px;
}

.acct-row-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.acct-row select {
    flex: 1;
    height: 34px;
    background: var(--bg);
    border: 1px solid var(--border-md);
    border-radius: var(--r-sm);
    padding: 0 28px 0 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364607c' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--t), box-shadow var(--t);
}
.acct-row select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.acct-row select option { background: var(--surface); }

.acct-balance-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-dim);
    border: 1px solid rgba(124,110,248,0.2);
    border-radius: var(--r-sm);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}


/* ===========================================================================
   FORM CARDS
   =========================================================================== */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: visible;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    position: relative;
}
.form-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124,110,248,0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.form-card:hover {
    border-color: rgba(124,110,248,0.22);
    box-shadow: 0 4px 28px rgba(0,0,0,0.35), 0 0 0 1px rgba(124,110,248,0.08);
    transform: translateY(-1px);
}
.form-card:hover::before { opacity: 1; }
.form-card:focus-within {
    border-color: rgba(124,110,248,0.35);
    box-shadow: 0 4px 32px rgba(0,0,0,0.35), 0 0 20px rgba(124,110,248,0.08), 0 0 0 1px rgba(124,110,248,0.15);
}
.form-card:focus-within::before { opacity: 1; }


.form-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--elevated) 0%, rgba(124,110,248,0.03) 100%);
}
.form-card-head i { width: 13px; height: 13px; flex-shrink: 0; color: var(--accent); filter: drop-shadow(0 0 3px rgba(124,110,248,0.5)); }

.form-grid {
    display: grid;
    gap: 14px;
    padding: 16px;
}
.col2 { grid-template-columns: 1fr 1fr; }
.col3 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }


/* ─── Fields & Inputs ────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; }

.field-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.field-row .field { flex: 1; min-width: 100px; }

label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
    display: block;
}

.field-note {
    font-size: 9.5px;
    font-weight: 400;
    color: var(--dim);
    text-transform: none;
    letter-spacing: 0;
    margin-left: 4px;
}

.field-err {
    font-size: 9.5px;
    font-weight: 500;
    color: var(--loss);
    float: right;
    text-transform: none;
    letter-spacing: 0;
}

input, select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: var(--elevated);
    border: 1px solid var(--border-md);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364607c' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

select option { background: var(--surface); }

input:focus, select:focus {
    border-color: rgba(124,110,248,0.6);
    box-shadow: 0 0 0 3px var(--accent-dim), 0 0 20px rgba(124,110,248,0.1);
    background: var(--elevated-2);
    transform: translateY(-0.5px);
}

input:disabled { opacity: 0.35; cursor: not-allowed; }

/* BE Row */
.be-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    flex-wrap: wrap;
}

.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.toggle-lbl {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.be-field { flex: 1; min-width: 160px; }

/* Toggle switch */
.sw { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }

.sw-track {
    position: absolute; inset: 0;
    background: var(--elevated-2);
    border: 1px solid var(--border-md);
    border-radius: 20px;
    cursor: pointer;
    transition: background var(--t), border-color var(--t);
}
.sw-track::before {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    left: 2px; top: 50%;
    transform: translateY(-50%);
    background: var(--muted);
    border-radius: 50%;
    transition: transform var(--t), background var(--t);
}

.sw input:checked + .sw-track {
    background: var(--accent-dim);
    border-color: var(--accent);
}
.sw input:checked + .sw-track::before {
    transform: translate(16px, -50%);
    background: var(--accent);
}

.toggle-row { display: flex; gap: 20px; flex-wrap: wrap; }


/* ─── Execute Button ─────────────────────────────────────────────────────── */
.exec-btn {
    width: 100%;
    height: 50px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: box-shadow var(--t), transform 0.15s ease;
    box-shadow: 0 4px 24px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
    position: relative;
    overflow: hidden;
}
/* Shine sweep animation */
.exec-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transform: skewX(-20deg);
    transition: none;
    animation: btn-shine 3.5s ease-in-out infinite;
}
@keyframes btn-shine {
    0%   { left: -75%; }
    35%  { left: 125%; }
    100% { left: 125%; }
}
.exec-btn i { width: 16px; height: 16px; position: relative; }
.exec-btn:hover {
    box-shadow: 0 8px 36px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-2px);
}
.exec-btn:active { transform: translateY(0); box-shadow: 0 2px 12px var(--accent-glow); }


/* ===========================================================================
   SECTION HEADERS
   =========================================================================== */
.sec-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.sec-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sec-title h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.sec-sub {
    font-size: 11.5px;
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    background: var(--accent-dim);
    color: var(--accent-text);
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    border: 1px solid rgba(124,110,248,0.25);
    box-shadow: 0 0 8px rgba(124,110,248,0.15);
    transition: box-shadow var(--t), transform var(--t);
}
.badge:not(:empty) { animation: badge-pop 0.35s var(--t-spring) both; }
@keyframes badge-pop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    background: var(--elevated);
    color: var(--muted);
    border: 1px solid var(--border-md);
    border-radius: var(--r-sm);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: color var(--t), border-color var(--t), background var(--t), box-shadow var(--t), transform 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.ghost-btn i { width: 12px; height: 12px; }
.ghost-btn:hover {
    color: var(--accent-text);
    border-color: rgba(124,110,248,0.4);
    background: var(--accent-dim);
    box-shadow: 0 0 12px rgba(124,110,248,0.15);
    transform: translateY(-1px);
}
.ghost-btn:active { transform: translateY(0); }
.ghost-btn.spinning i { animation: spin 0.6s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }


/* ===========================================================================
   TABLES
   =========================================================================== */
.tbl-wrap {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    transition: box-shadow var(--t);
}
.tbl-wrap:hover {
    box-shadow: 0 4px 28px rgba(0,0,0,0.35);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

th {
    background: var(--elevated);
    padding: 9px 14px;
    text-align: left;
    font-size: 9.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.9px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}

tr:last-child td { border-bottom: none; }
tbody tr {
    transition: background 0.2s ease;
    position: relative;
}
tbody tr:hover td {
    background: rgba(124, 110, 248, 0.05);
}
tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}
/* Staggered row entry animation */
/* Staggered row entry animation */
@keyframes row-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}
tbody tr { animation: row-in 0.3s var(--ease-out-expo) both; }
tbody tr:nth-child(1)  { animation-delay: 0.02s; }
tbody tr:nth-child(2)  { animation-delay: 0.05s; }
tbody tr:nth-child(3)  { animation-delay: 0.08s; }
tbody tr:nth-child(4)  { animation-delay: 0.11s; }
tbody tr:nth-child(5)  { animation-delay: 0.14s; }
tbody tr:nth-child(6)  { animation-delay: 0.17s; }
tbody tr:nth-child(7)  { animation-delay: 0.20s; }
tbody tr:nth-child(8)  { animation-delay: 0.23s; }
tbody tr:nth-child(9)  { animation-delay: 0.26s; }
tbody tr:nth-child(10) { animation-delay: 0.29s; }
tbody tr:nth-child(11) { animation-delay: 0.32s; }
tbody tr:nth-child(12) { animation-delay: 0.35s; }

.empty-cell {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--muted);
    font-size: 13px;
}

/* Type badges */
.buy-badge, .sell-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.buy-badge  { background: var(--profit-dim); color: var(--profit); }
.sell-badge { background: var(--loss-dim);   color: var(--loss); }

.profit { color: var(--profit); }
.loss   { color: var(--loss); }

/* PnL animations */
@keyframes pg { 0%,100% { color:var(--profit); } 50% { color:#34d399; text-shadow:0 0 8px rgba(16,217,138,.4); } }
@keyframes pr { 0%,100% { color:var(--loss);   } 50% { color:#f87171; text-shadow:0 0 8px rgba(241,79,79,.4); } }
.profit-tick { animation: pg 0.8s ease-out; }
.loss-tick   { animation: pr 0.8s ease-out; }

/* Row action buttons */
.btn-edit {
    height: 26px; padding: 0 11px;
    background: var(--elevated-2);
    color: var(--text-2);
    border: 1px solid var(--border-md);
    border-radius: var(--r-sm);
    font-size: 11px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: color var(--t), border-color var(--t), background var(--t);
}
.btn-edit:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-dim); }

/* → BE one-tap button */
.btn-be {
    height: 26px; padding: 0 10px;
    background: var(--accent-dim);
    color: var(--accent-text);
    border: 1px solid rgba(124,110,248,0.25);
    border-radius: var(--r-sm);
    font-size: 11px; font-weight: 700;
    font-family: inherit; cursor: pointer;
    transition: background var(--t), border-color var(--t), transform 0.1s;
    white-space: nowrap;
}
.btn-be:hover {
    background: rgba(124,110,248,0.22);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.btn-be:active { transform: translateY(0); }

/* × Close position button */
.btn-close-pos {
    height: 26px; width: 26px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent;
    color: var(--loss);
    border: 1px solid rgba(241,79,79,0.35);
    border-radius: var(--r-sm);
    font-size: 14px; font-weight: 700;
    font-family: inherit; cursor: pointer;
    transition: background var(--t), border-color var(--t);
}
.btn-close-pos:hover {
    background: var(--loss-dim);
    border-color: var(--loss);
}

/* Lot Size Preview strip */
/* Lot Size Preview strip */
.lot-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-top: 8px;
    animation: lotPreviewIn 0.35s var(--ease-out-expo) both;
}

@keyframes lotPreviewIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lot-preview-item {
    background: var(--elevated);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.2s;
}
.lot-preview-item:hover {
    background: var(--elevated-2);
}

.lot-preview-lbl {
    font-size: 9px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.lot-preview-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    transition: color 0.3s, text-shadow 0.3s;
}

.btn-cancel {
    height: 26px; padding: 0 11px; margin-left: 5px;
    background: transparent; color: var(--loss);
    border: 1px solid var(--loss);
    border-radius: var(--r-sm);
    font-size: 11px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: background var(--t);
}
.btn-cancel:hover { background: var(--loss-dim); }


/* ===========================================================================
   ACCOUNTS DASHBOARD - Redesigned Cards
   =========================================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 60px 20px;
    color: var(--muted);
    font-size: 13px;
}

.spinner {
    width: 22px; height: 22px;
    border: 2px solid var(--border-md);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* Account Card */
.acc-card {
    position: relative;
    background: linear-gradient(145deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.008) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: transform 0.35s var(--ease-spring), box-shadow 0.35s ease, border-color 0.3s ease;
    animation: cardSlideUp 0.5s var(--ease-out-expo) backwards;
}
.acc-card:nth-child(1) { animation-delay: 0.05s; }
.acc-card:nth-child(2) { animation-delay: 0.12s; }
.acc-card:nth-child(3) { animation-delay: 0.19s; }
.acc-card:nth-child(4) { animation-delay: 0.26s; }
.acc-card:nth-child(5) { animation-delay: 0.33s; }
.acc-card:nth-child(6) { animation-delay: 0.40s; }

@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.acc-card:hover {
    transform: translateY(-4px) scale(1.015);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
    border-color: rgba(255,255,255,0.16);
    z-index: 10;
}
.acc-card[data-status="ACTIVE"]:hover     { box-shadow: 0 16px 40px rgba(16, 217, 138, 0.15); border-color: rgba(16, 217, 138, 0.3); }
.acc-card[data-status="NEAR_LIMIT"]:hover { box-shadow: 0 16px 40px rgba(243, 171, 38, 0.15); border-color: rgba(243, 171, 38, 0.3); }
.acc-card[data-status="BREACHED"]:hover   { box-shadow: 0 16px 40px rgba(241, 79, 79, 0.15); border-color: rgba(241, 79, 79, 0.3); }

/* Accent bar */
.acc-card-bar { height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.acc-card[data-status="NEAR_LIMIT"] .acc-card-bar { background: linear-gradient(90deg, var(--warn), #d97706); }
.acc-card[data-status="BREACHED"]   .acc-card-bar { background: linear-gradient(90deg, var(--loss), #c43030); }

.acc-card-body { padding: 16px; }

/* Card header row */
.acc-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.acc-id-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.acc-lbl {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.3px;
}

.acc-id {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.acc-terminal { font-size: 10px; color: var(--dim); }

.acc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Status pill */
.s-pill {
    display: inline-flex; align-items: center;
    font-size: 9px; font-weight: 700; letter-spacing: 0.8px;
    text-transform: uppercase; padding: 3px 9px; border-radius: 20px;
    white-space: nowrap;
}
.s-pill.active     { background: var(--profit-dim); color: var(--profit); }
.s-pill.near-limit { background: var(--warn-dim);   color: var(--warn); }
.s-pill.breached   {
    background: var(--loss-dim); color: var(--loss);
    animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Icon button */
.icon-btn {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--elevated-2);
    border: 1px solid var(--border-md);
    border-radius: var(--r-sm);
    color: var(--muted); cursor: pointer;
    transition: color var(--t), border-color var(--t), background var(--t);
    flex-shrink: 0;
}
.icon-btn i { width: 13px; height: 13px; }
.icon-btn:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-dim); }

/* Metrics grid - 2 rows × 2 columns for better readability */
.acc-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.metric {
    background: var(--elevated);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--r-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.m-label {
    font-size: 9px; font-weight: 700;
    color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px;
}

.m-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px; font-weight: 700;
    color: var(--text); font-variant-numeric: tabular-nums;
    transition: color 0.3s, text-shadow 0.3s;
}
.m-value.hi  { color: var(--accent-text); text-shadow: 0 0 12px rgba(124,110,248,0.2); }
.m-value.hi-g { color: var(--profit); text-shadow: 0 0 12px rgba(16,217,138,0.2); }
.m-value.dim { color: var(--muted); font-weight: 600; font-size: 13px; }

/* DD sections */
.dd-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dd-section {
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 12px;
}

.dd-row {
    display: flex; align-items: flex-start;
    justify-content: space-between; gap: 8px; margin-bottom: 8px;
}

.dd-info { flex: 1; min-width: 0; }

.dd-label {
    font-size: 11.5px; font-weight: 600;
    color: var(--text-2); display: block;
}

.dd-sub {
    font-size: 10px; color: var(--muted);
    font-variant-numeric: tabular-nums; margin-top: 3px; display: block;
}

.dd-pct {
    font-size: 13px; font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; padding-top: 1px;
}

.dd-disabled {
    font-size: 11px; color: var(--dim);
    font-style: italic;
}

/* Progress bar */
.pbar {
    height: 5px;
    background: var(--elevated-2);
    border-radius: 3px;
    overflow: hidden;
}

.pfill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-text));
    min-width: 3px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 0 8px rgba(124,110,248,0.3);
    overflow: hidden;
}
.pfill::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; bottom: 0;
    width: 60%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: pfill-shimmer 2.2s ease-in-out infinite;
}
.pfill.warn { background: linear-gradient(90deg, var(--warn), #fbbf24); box-shadow: 0 0 8px rgba(245,158,11,0.3); }
.pfill.red  { background: linear-gradient(90deg, var(--loss), #f87171); box-shadow: 0 0 8px rgba(241,79,79,0.3); }


/* ===========================================================================
   MARKET BIAS TABLE
   =========================================================================== */
.bias-badge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    white-space: nowrap; letter-spacing: 0.2px;
}
.bias-bullish { background: var(--profit-dim); color: var(--profit); }
.bias-bearish { background: var(--loss-dim);   color: var(--loss); }
.bias-choppy  { background: var(--warn-dim);   color: var(--warn); }
.bias-unknown { background: var(--elevated);   color: var(--muted); }

.fc-item { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 5px; }
.fc-item:last-child { margin-bottom: 0; }

.fc-pct {
    font-size: 11px; font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    min-width: 30px; text-align: right;
}

.mini-bar { flex: 1; height: 3px; background: var(--elevated-2); border-radius: 2px; overflow: hidden; }
.mini-fill { height: 100%; border-radius: 2px; background: var(--accent); transition: width 0.5s ease; }
.mini-fill.warn { background: var(--warn); }
.mini-fill.red  { background: var(--loss); }

/* Session name tag shown above each bias badge */
.sess-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--dim);
    margin-bottom: 4px;
}

/* Confidence % shown inline inside the ML prediction badge */
.bias-conf {
    display: inline-block;
    margin-left: 5px;
    font-size: 9.5px;
    font-weight: 600;
    opacity: 0.75;
    letter-spacing: 0;
}

/* Ensure the fc-item in the next-session column aligns nicely */
.fc-item { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 5px; min-width: 120px; }
.fc-item:last-child { margin-bottom: 0; }

/* ── Confidence Signal Bars ──────────────────────────────────────────────── */
/*
 *  Threshold rules:
 *   RED    (1 bar)  - Neutral dominant OR directional < 38%  → Avoid
 *   YELLOW (2 bars) - Directional is 38–44.9%               → Caution
 *   GREEN  (3 bars) - Directional ≥ 45%                     → Strong
 */

@keyframes glow-flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes profit-text-flash {
    0%   { text-shadow: 0 0 12px rgba(16, 217, 138, 1); }
    100% { text-shadow: none; }
}
@keyframes loss-text-flash {
    0%   { text-shadow: 0 0 12px rgba(241, 79, 79, 1); }
    100% { text-shadow: none; }
}

.td-pnl {
    position: relative;
    z-index: 1;
}
.td-pnl::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
}
.td-pnl.profit::before {
    background: radial-gradient(circle at center, rgba(16, 217, 138, 0.35) 0%, transparent 60%);
}
.td-pnl.loss::before {
    background: radial-gradient(circle at center, rgba(241, 79, 79, 0.35) 0%, transparent 60%);
}

.profit-tick { animation: profit-text-flash 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.profit-tick::before { animation: glow-flash 0.8s cubic-bezier(0.22, 1, 0.36, 1); }

.loss-tick { animation: loss-text-flash 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.loss-tick::before { animation: glow-flash 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
/* Wrapper: sits below the bias badge */
.conf-signal {
    display: inline-flex;
    background: var(--warn);
    box-shadow: 0 0 5px rgba(251, 191, 36, 0.5);
}
.conf-signal.conf-yellow .sig-label { color: var(--warn); }

/* ── GREEN - all 3 bars lit ───────────────────────────────────────────────── */
.conf-signal.conf-green .b1,
.conf-signal.conf-green .b2,
.conf-signal.conf-green .b3 {
    background: var(--profit);
    box-shadow: 0 0 5px rgba(16, 217, 138, 0.5);
}
.conf-signal.conf-green .b3 {
    animation: sig-pulse 2s ease-in-out infinite;
}
.conf-signal.conf-green .sig-label { color: var(--profit); }

@keyframes sig-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(16, 217, 138, 0.5); }
    50%       { box-shadow: 0 0 10px rgba(16, 217, 138, 0.9); }
}

/* vertical-align for bias table cells is now in the #bias_table td rule */

/* ── Next-session header row: direction badge + conf signal side by side ─── */
.next-sess-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

/* ── Dominant Direction Badge ─────────────────────────────────────────────── */
.dir-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px 2px 6px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.dir-bull {
    background: rgba(16, 217, 138, 0.10);
    color: var(--profit);
    border-color: rgba(16, 217, 138, 0.22);
}
.dir-bear {
    background: rgba(241, 79, 79, 0.10);
    color: var(--loss);
    border-color: rgba(241, 79, 79, 0.22);
}
.dir-neutral {
    background: rgba(245, 158, 11, 0.10);
    color: var(--warn);
    border-color: rgba(245, 158, 11, 0.22);
}

/* ── Live PnL cell tick flash (used by flicker-free renderTables) ─────────── */
@keyframes profit-flash {
    0%   { 
        background: rgba(16, 217, 138, 0.15);
        box-shadow: inset 0 0 12px rgba(16, 217, 138, 0.4), 0 0 12px rgba(16, 217, 138, 0.2);
        text-shadow: 0 0 8px rgba(16, 217, 138, 0.8);
    }
    100% { 
        background: transparent;
        box-shadow: inset 0 0 0 transparent, 0 0 0 transparent;
        text-shadow: none;
    }
}
@keyframes loss-flash {
    0%   { 
        background: rgba(241, 79, 79, 0.15);
        box-shadow: inset 0 0 12px rgba(241, 79, 79, 0.4), 0 0 12px rgba(241, 79, 79, 0.2);
        text-shadow: 0 0 8px rgba(241, 79, 79, 0.8);
    }
    100% { 
        background: transparent;
        box-shadow: inset 0 0 0 transparent, 0 0 0 transparent;
        text-shadow: none;
    }
}
.profit-tick { animation: profit-flash 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.loss-tick   { animation: loss-flash 0.8s cubic-bezier(0.22, 1, 0.36, 1); }

