/**
 * trade_builder.css
 * Styles for the Trade Builder subtab within Trade Advisor.
 * 3-column layout: Left (construction) | Center (MC chart) | Right (intel)
 * All classes prefixed with .tb- to avoid collisions.
 *
 * Design tokens inherited from base theme (--bg-card, --accent-cyan, etc.)
 * @created 2026-03-17
 */

/* ============================================================
   ROOT CONTAINER
   ============================================================ */
.tb-root {
    display: flex;
    flex-direction: column;
    /* Use viewport-relative height as subtab container doesn't propagate height */
    height: calc(100vh - 200px);
    min-height: 500px;
    overflow: hidden;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.tb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    background: rgba(6, 182, 212, 0.03);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 10px;
    min-height: 38px;
}

.tb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.tb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Entry badge (shown when entering from a recommendation) */
.tb-entry-badge {
    font-size: 0.68rem;
    padding: 3px 10px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.12);
    color: var(--accent-purple, #7c3aed);
    border: 1px solid rgba(124, 58, 237, 0.2);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Inline badges row (replaces old toolbar) */
.tb-inline-badges {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    flex-shrink: 0;
}


/* Regime badge */
.tb-regime-badge {
    font-size: 0.55rem;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.10);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-green, #10b981);
    white-space: nowrap;
}

.tb-regime-badge.tb-regime-negative {
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red, #ef4444);
}

.tb-regime-badge.tb-regime-neutral {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--accent-yellow, #f59e0b);
}

/* ============================================================
   SECONDARY BUTTON (toolbar & bottom bar)
   ============================================================ */
.tb-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted, #9ca3af);
    font-size: 0.70rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
}

.tb-btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-cyan, #06b6d4);
    color: var(--text-secondary, #d1d5db);
}

.tb-btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tb-btn-secondary svg {
    width: 13px;
    height: 13px;
}

/* ============================================================
   3-COLUMN LAYOUT
   ============================================================ */
.tb-layout {
    display: grid;
    grid-template-columns: 272px 1fr 290px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    transition: grid-template-columns 0.25s ease;
}

/* Collapsed right panel */
.tb-layout.tb-collapsed-right {
    grid-template-columns: 272px 1fr 44px;
}

/* ============================================================
   LEFT PANEL (Trade Construction)
   ============================================================ */
.tb-panel-left {
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-secondary, #1a1a2e);
}

/* ============================================================
   CENTER PANEL (MC Chart)
   ============================================================ */
.tb-panel-center {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;  /* Prevent grid item from overflowing 1fr track */
}

#tb-chart-root {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Overlay layers for DEX and GEX */
.tb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ============================================================
   RIGHT PANEL (Intelligence)
   ============================================================ */
.tb-panel-right {
    border-left: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #1a1a2e);
    padding: 10px 12px;
    transition: padding 0.25s ease;
}

.tb-panel-right.tb-collapsed {
    padding: 10px 4px;
}

/* Collapse toggle button */
.tb-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 3px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 0.58rem;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.tb-collapse-btn:hover {
    background: var(--bg-hover, rgba(255,255,255,0.06));
    color: var(--text-secondary, #d1d5db);
}

.tb-collapse-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
}

/* Intel expanded content */
.tb-intel-expanded {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.tb-panel-right.tb-collapsed .tb-intel-expanded {
    display: none;
}

/* Collapsed score pills strip */
.tb-intel-collapsed {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    overflow: hidden;
}

.tb-panel-right:not(.tb-collapsed) .tb-intel-collapsed {
    display: none;
}

/* Score pills in collapsed state */
.tb-score-pill {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan, #06b6d4);
    border: 1px solid rgba(6, 182, 212, 0.2);
    flex-shrink: 0;
}

.tb-score-pill:hover {
    transform: scale(1.1);
}

.tb-score-pill.tb-pill-ts {
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green, #10b981);
    border-color: rgba(16, 185, 129, 0.2);
}

.tb-score-pill.tb-pill-fs {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan, #06b6d4);
    border-color: rgba(6, 182, 212, 0.2);
}

.tb-score-pill.tb-pill-pc {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-yellow, #f59e0b);
    border-color: rgba(245, 158, 11, 0.2);
}

/* ============================================================
   PLACEHOLDER (empty state for all panels)
   ============================================================ */
.tb-panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    min-height: 160px;
    color: var(--text-muted, #9ca3af);
    text-align: center;
    padding: 24px 16px;
}

.tb-panel-placeholder p {
    font-size: 0.78rem;
    color: var(--text-muted, #9ca3af);
    margin: 0;
}

.tb-chart-placeholder {
    min-height: 240px;
}

/* ============================================================
   PROBABILITY STRIP
   ============================================================ */
.tb-probability-strip {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 6px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary, #1a1a2e);
    flex-shrink: 0;
    min-height: 36px;
}

.tb-prob-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-shrink: 0;
}

.tb-prob-label {
    font-size: 0.60rem;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tb-prob-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-green, #10b981);
}

.tb-prob-value.tb-prob-loss {
    color: var(--accent-red, #ef4444);
}

/* Probability bar */
.tb-prob-bar-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.tb-prob-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green, #10b981), var(--accent-cyan, #06b6d4));
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* ============================================================
   BOTTOM ACTION BAR
   ============================================================ */
.tb-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card, #1e1e2f);
    flex-shrink: 0;
    gap: 12px;
    min-height: 44px;
}

.tb-summary {
    flex: 1;
    min-width: 0;
}

.tb-summary-text {
    font-size: 0.72rem;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Execute (primary CTA) */
.tb-btn-execute {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 16px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, var(--accent-cyan, #06b6d4), var(--accent-blue, #3b82f6));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    font-family: inherit;
}

.tb-btn-execute:hover:not(:disabled) {
    opacity: 0.90;
    transform: translateY(-1px);
}

.tb-btn-execute:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.tb-btn-execute svg {
    width: 13px;
    height: 13px;
}

/* ============================================================
   CONSTRUCTION PANEL INNER STYLES (Task 7)
   ============================================================ */

.tb-section {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.tb-section:last-child {
    border-bottom: none;
}

.tb-section-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.62rem;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 8px;
}

.tb-step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan, #06b6d4);
    font-size: 0.60rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Underlying search */
.tb-und-search-wrap {
    position: relative;
}

.tb-und-search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    color: var(--text-muted, #9ca3af);
    pointer-events: none;
}

.tb-und-search {
    width: 100%;
    padding: 7px 10px 7px 28px;
    background: var(--bg-input, rgba(255,255,255,0.06));
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary, #f3f4f6);
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.tb-und-search:focus {
    border-color: var(--accent-cyan, #06b6d4);
}

.tb-und-search::placeholder {
    color: var(--text-muted, #9ca3af);
}

.tb-symbol-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card, #1e1e2f);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    z-index: 100;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.tb-sym-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    transition: background 0.1s;
}

.tb-sym-opt:hover {
    background: var(--bg-hover, rgba(255,255,255,0.06));
}

.tb-sym-loading {
    color: rgba(255,255,255,0.35);
    font-size: 0.75rem;
    cursor: default;
    padding: 10px;
}

.tb-sym-code {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--accent-cyan, #06b6d4);
    min-width: 44px;
}

.tb-sym-name {
    font-size: 0.68rem;
    color: var(--text-muted, #9ca3af);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Underlying loaded state */
.tb-und-main {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card, #1e1e2f);
    border-radius: 7px;
    border: 1px solid rgba(6, 182, 212, 0.15);
    position: relative;
}

.tb-und-left { flex: 1; min-width: 0; }

.tb-und-ticker {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-cyan, #06b6d4);
}

.tb-und-name {
    font-size: 0.60rem;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tb-und-right {
    text-align: right;
    flex-shrink: 0;
}

.tb-und-price {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary, #f3f4f6);
}

.tb-und-change { font-size: 0.62rem; }
.tb-und-change.g { color: var(--accent-green, #10b981); }
.tb-und-change.r { color: var(--accent-red, #ef4444); }

.tb-und-clear {
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s;
}

.tb-und-clear:hover { color: var(--accent-red, #ef4444); }
.tb-und-clear svg { width: 13px; height: 13px; }

.tb-und-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.tb-und-chip {
    display: flex;
    gap: 3px;
    align-items: center;
    padding: 2px 7px;
    background: var(--bg-card, #1e1e2f);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-size: 0.60rem;
}

.tb-und-chip .l { color: var(--text-muted, #9ca3af); }
.tb-und-chip .v { font-weight: 600; color: var(--text-secondary, #d1d5db); }
.tb-und-chip .v.g { color: var(--accent-green, #10b981); }
.tb-und-chip .v.y { color: var(--accent-yellow, #f59e0b); }
.tb-und-chip .v.r { color: var(--accent-red, #ef4444); }

/* Strategy picker */
.tb-strat-cat {
    font-size: 0.52rem;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 8px 0 4px 2px;
}

.tb-strat-cat:first-child { margin-top: 0; }

.tb-strat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 2px;
}

.tb-strat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 4px;
    background: var(--bg-card, #1e1e2f);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
    color: var(--text-secondary, #d1d5db);
    font-size: 0.68rem;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
    text-align: center;
}

.tb-strat-btn:hover {
    border-color: var(--text-muted, #9ca3af);
}

.tb-strat-btn.tb-strat-active {
    border-color: var(--accent-cyan, #06b6d4);
    color: var(--accent-cyan, #06b6d4);
    background: rgba(6, 182, 212, 0.06);
}

.tb-sc { font-weight: 700; display: block; font-size: 0.70rem; }
.tb-sn { font-size: 0.50rem; color: var(--text-muted, #9ca3af); display: block; margin-top: 1px; }
.tb-strat-active .tb-sn { color: rgba(6, 182, 212, 0.6); }

/* Leg row */
.tb-leg {
    background: var(--bg-card, #1e1e2f);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid var(--border-color);
}

.tb-leg-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tb-leg-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 500;
}

.tb-leg-tag {
    font-size: 0.55rem;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
}

.tb-leg-tag.sell { background: rgba(239, 68, 68, 0.12); color: var(--accent-red, #ef4444); }
.tb-leg-tag.buy  { background: rgba(16, 185, 129, 0.12); color: var(--accent-green, #10b981); }

.tb-leg-type { color: var(--text-secondary, #d1d5db); }

.tb-leg-action-sel { display: none; }

.tb-leg-x {
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    font-size: 0.90rem;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.tb-leg-x:hover { color: var(--accent-red, #ef4444); }

.tb-leg-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

.tb-lf { display: flex; flex-direction: column; gap: 2px; }

.tb-lf label {
    font-size: 0.52rem;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
}

.tb-lf input,
.tb-lf select {
    padding: 5px 6px;
    background: var(--bg-input, rgba(255,255,255,0.06));
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary, #f3f4f6);
    font-size: 0.70rem;
    font-family: inherit;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.tb-lf input:focus,
.tb-lf select:focus { border-color: var(--accent-cyan, #06b6d4); }

.tb-lf select { cursor: pointer; }
.tb-lf select option { background: var(--bg-card, #1e1e2f); }

.tb-leg-delta-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tb-leg-delta-row label {
    font-size: 0.52rem;
    color: var(--text-muted, #9ca3af);
    min-width: 14px;
}

.tb-leg-delta-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent-cyan, #06b6d4);
    height: 3px;
}

.tb-dv {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent-cyan, #06b6d4);
    min-width: 30px;
    text-align: right;
}

.tb-lock-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.62rem;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 4px;
    transition: color 0.15s;
    margin-bottom: 4px;
    user-select: none;
}

.tb-lock-row:hover { color: var(--text-secondary, #d1d5db); }

.tb-add-leg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 6px;
    border: 1px dashed var(--border-color);
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted, #9ca3af);
    font-size: 0.68rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.tb-add-leg:hover {
    border-color: var(--accent-cyan, #06b6d4);
    color: var(--accent-cyan, #06b6d4);
}

.tb-add-leg svg { width: 12px; height: 12px; }

.tb-no-legs-hint {
    font-size: 0.68rem;
    color: var(--text-muted, #9ca3af);
    text-align: center;
    padding: 6px 0 10px;
    margin: 0;
}

/* Size row */
.tb-size-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.tb-size-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tb-size-group label {
    font-size: 0.52rem;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
}

.tb-size-expiry { flex: 1; }

.tb-size-expiry select {
    width: 100%;
    padding: 5px 6px;
    background: var(--bg-input, rgba(255,255,255,0.06));
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary, #f3f4f6);
    font-size: 0.68rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.tb-size-expiry select:focus { border-color: var(--accent-cyan, #06b6d4); }
.tb-size-expiry select option { background: var(--bg-card, #1e1e2f); }

.tb-stepper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.tb-stepper button {
    width: 24px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted, #9ca3af);
    font-size: 0.90rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.tb-stepper button:hover {
    background: var(--bg-hover, rgba(255,255,255,0.06));
    color: var(--text-primary, #f3f4f6);
}

.tb-sv {
    min-width: 28px;
    text-align: center;
    font-size: 0.80rem;
    font-weight: 700;
    color: var(--text-primary, #f3f4f6);
    padding: 0 2px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    line-height: 28px;
}

/* ============================================================
   MC CHART INNER STYLES (Task 8)
   ============================================================ */

/* Chart header */
.tb-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary, #1a1a2e);
    flex-shrink: 0;
    gap: 10px;
    min-height: 38px;
    flex-wrap: wrap;
}

.tb-chart-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tb-chart-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary, #f3f4f6);
}

.tb-chart-badge {
    font-size: 0.60rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.10);
    color: var(--accent-cyan, #06b6d4);
    border: 1px solid rgba(6, 182, 212, 0.20);
}

/* Chart controls */
.tb-chart-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tb-toggle-group {
    display: flex;
    align-items: center;
    gap: 3px;
}

.tb-toggle-label {
    font-size: 0.58rem;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    margin-right: 3px;
    white-space: nowrap;
}

.tb-ct-btn {
    padding: 3px 9px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted, #9ca3af);
    font-size: 0.66rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.tb-ct-btn:hover {
    border-color: var(--text-muted, #9ca3af);
    color: var(--text-secondary, #d1d5db);
}

.tb-ct-btn.tb-ct-active {
    border-color: var(--accent-cyan, #06b6d4);
    color: var(--accent-cyan, #06b6d4);
    background: rgba(6, 182, 212, 0.08);
}

.tb-ct-overlay.tb-ct-active {
    border-color: var(--accent-green, #10b981);
    color: var(--accent-green, #10b981);
    background: rgba(16, 185, 129, 0.08);
}

.tb-xray-btn.tb-ct-active {
    border-color: var(--accent-purple, #a78bfa);
    color: var(--accent-purple, #a78bfa);
    background: rgba(167, 139, 250, 0.10);
}

.tb-expand-btn {
    font-size: 1rem;
    padding: 2px 6px;
    margin-left: 8px;
}

/* Zoom slider */
.tb-zoom-group {
    margin-left: 4px;
}
.tb-zoom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 64px;
    height: 4px;
    background: rgba(255,255,255,0.12);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
}
.tb-zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(96,165,250,0.85);
    border: 1px solid rgba(96,165,250,0.5);
    cursor: pointer;
}
.tb-zoom-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(96,165,250,0.85);
    border: 1px solid rgba(96,165,250,0.5);
    cursor: pointer;
}
.tb-zoom-slider:hover::-webkit-slider-thumb {
    background: rgba(96,165,250,1);
}
.tb-zoom-slider:hover::-moz-range-thumb {
    background: rgba(96,165,250,1);
}

/* Expanded chart — grid takes full width, hides left/right panels */
.tb-layout.tb-chart-expanded {
    grid-template-columns: 0px 1fr 0px;
}
.tb-layout.tb-chart-expanded .tb-panel-left,
.tb-layout.tb-chart-expanded .tb-panel-right {
    overflow: hidden;
    visibility: hidden;
    border: none;
}

/* SVG wrapper */
.tb-svg-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.tb-svg-wrap svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Drag hint */
.tb-drag-hint {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.58rem;
    color: rgba(255,255,255,0.20);
    pointer-events: none;
    white-space: nowrap;
}

/* ============================================================
   P&L SLIDERS
   ============================================================ */
.tb-pnl-sliders {
    display: flex;
    gap: 24px;
    padding: 6px 16px;
    background: rgba(15,17,23,0.80);
    border-top: 1px solid rgba(255,255,255,0.06);
}
.tb-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.tb-slider-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    min-width: 24px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tb-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.10);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.tb-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #60a5fa;
    border: 2px solid rgba(15,17,23,0.90);
    cursor: grab;
}
.tb-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #60a5fa;
    border: 2px solid rgba(15,17,23,0.90);
    cursor: grab;
}
.tb-slider-value {
    font-size: 0.70rem;
    font-weight: 600;
    color: #60a5fa;
    min-width: 38px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   STRATEGY AUTO-DETECT BADGE (Task 14)
   ============================================================ */
.tb-auto-detect-label {
    font-size: 0.64rem;
    font-weight: 500;
    color: var(--accent-cyan, #06b6d4);
    background: rgba(6,182,212,0.10);
    border: 1px solid rgba(6,182,212,0.25);
    border-radius: 10px;
    padding: 1px 7px;
    margin-left: 7px;
    vertical-align: middle;
    white-space: nowrap;
}


/* ============================================================
   RIGHT PANEL — INTEL BLOCKS (Task 11)
   ============================================================ */
.tb-intel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    min-height: 180px;
    color: rgba(255,255,255,0.25);
    font-size: 0.78rem;
    text-align: center;
    padding: 20px;
}

.tb-intel-placeholder i[data-lucide] {
    width: 28px;
    height: 28px;
    opacity: 0.25;
}

.tb-intel-placeholder p {
    margin: 0;
    font-size: 0.82rem;
}

.tb-intel-sub {
    font-size: 0.72rem !important;
    color: rgba(255,255,255,0.18);
}

.tb-intel-block {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tb-intel-block:last-child {
    border-bottom: none;
}

.tb-intel-title {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.38);
    margin-bottom: 7px;
}

/* Score rows */
.tb-score-row {
    display: grid;
    grid-template-columns: 1fr auto 80px;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.tb-score-label {
    font-size: 0.74rem;
    color: rgba(255,255,255,0.65);
}

.tb-score-val {
    font-size: 0.74rem;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
}

.tb-score-bar {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}

.tb-score-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Entry check rows */
.tb-check-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 5px;
}

.tb-check-icon {
    font-size: 0.72rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.tb-check-text {
    font-size: 0.73rem;
    color: rgba(255,255,255,0.65);
    line-height: 1.4;
}

.tb-check-warn {
    color: var(--accent-yellow, #f59e0b);
}

/* Key-value rows (MC Summary, Portfolio Impact) */
.tb-kv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 8px;
}

.tb-kv-key {
    font-size: 0.73rem;
    color: rgba(255,255,255,0.50);
}

.tb-kv-val {
    font-size: 0.73rem;
    font-weight: 500;
    color: rgba(255,255,255,0.80);
    text-align: right;
}

.tb-kv-loss {
    color: var(--accent-red, #ef4444);
}

/* Psychological risk block */
.tb-psych-warn {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.60);
    line-height: 1.5;
    padding: 6px 8px;
    background: rgba(245,158,11,0.08);
    border-left: 2px solid var(--accent-yellow, #f59e0b);
    border-radius: 0 4px 4px 0;
}

/* Intel note (below scores block) */
.tb-intel-note {
    margin: 6px 0 0;
    font-size: 0.66rem;
    color: rgba(255,255,255,0.22);
    text-align: right;
}

/* ── Fit Score Breakdown (Shield mode) ────────────────────── */
.tb-fit-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 11px;
}
.tb-fit-bar-label {
    width: 80px;
    text-align: right;
    color: var(--text-secondary, #9ca3af);
    font-size: 10px;
    flex-shrink: 0;
}
.tb-fit-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}
.tb-fit-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.tb-fit-bar-val {
    width: 24px;
    font-weight: 600;
    font-size: 11px;
    text-align: right;
    flex-shrink: 0;
}
.tb-fit-insight {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.12);
    border-radius: 6px;
    font-size: 10px;
    color: var(--text-secondary, #9ca3af);
}
.tb-fit-insight strong {
    color: var(--accent-green, #10b981);
}
