/* Interface V2 Styles */

/* --- Layout --- */

.iv2-dashboard {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* --- Header (Top Bar) --- */
.iv2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.iv2-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.iv2-controls-disabled {
    opacity: 0.45;
}

.iv2-controls-disabled button,
.iv2-controls-disabled input {
    cursor: not-allowed;
}

.iv2-subnav {
    display: none;
}

.iv2-subnav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.iv2-subnav-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.iv2-subnav-btn.active {
    color: var(--accent);
    border-color: rgba(0, 242, 234, 0.35);
    background: rgba(0, 242, 234, 0.08);
}

.iv2-settings-toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.iv2-settings-toggle-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.iv2-settings-toggle-btn.active {
    color: var(--accent);
    border-color: rgba(0, 242, 234, 0.35);
    background: rgba(0, 242, 234, 0.08);
}

/* --- Body: Sidebar + Grid --- */
.iv2-body {
    display: flex;
    gap: 1rem;
}

.iv2-main {
    flex: 1;
    min-width: 0;
}

/* --- Sidebar --- */
.iv2-sidebar {
    flex-shrink: 0;
    width: 160px;
    /* Increased width for better spacing */
    position: sticky;
    top: 10px;
    align-self: flex-start;
    padding-right: 0.5rem;
    border-right: 1px solid var(--border);
}

.iv2-filter-section {
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.iv2-filter-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.iv2-filter-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    /* Restored margin for sections without a title-row */
}

.iv2-filter-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.iv2-filter-title-row .iv2-filter-title {
    margin-bottom: 0;
}

.iv2-select-all-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-style: italic;
    cursor: pointer;
    font-weight: 500;
    transition: border-color 0.2s, background-color 0.2s;
}

.iv2-select-all-btn:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.iv2-checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.iv2-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    user-select: none;
    background: transparent;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.iv2-checkbox-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.iv2-checkbox-item.active {
    background: rgba(0, 242, 234, 0.1);
    color: var(--accent);
    border-color: rgba(0, 242, 234, 0.3);
    font-weight: 600;
}

.iv2-checkbox-item input[type="checkbox"] {
    display: none;
}

/* --- Priority Filter Row (Joined Buttons) --- */
.iv2-filter-row {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.iv2-filter-row .iv2-checkbox-item {
    flex-grow: 1;
    justify-content: center;
    text-align: center;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    /* Remove separation border */
}

/* Border separator REMOVED */
.iv2-filter-row .iv2-checkbox-item::after {
    display: none;
}

.iv2-filter-row .iv2-priority-btn {
    flex-shrink: 0;
    width: 32px;
    /* Fixed width for the toggle */
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    /* Full Border */
    border: 1px solid var(--border);
    margin-left: -1px;
    /* Overlap slightly/flush */
}

.iv2-priority-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-tertiary);
    /* Explicit Border */
    border: 1px solid var(--border);

    background: rgba(255, 255, 255, 0.02);
    /* Slight contrast */
    transition: all 0.2s ease;
    user-select: none;
}

/* Re-apply border radius for standalone (if any) - but here strictly joined */
.iv2-filter-row .iv2-priority-btn {
    border: 1px solid var(--border);
}

.iv2-priority-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.iv2-priority-btn.active {
    color: #FFD700;
    /* Gold Text */
    background: rgba(255, 215, 0, 0.15);
    /* Yellow Tint Background */
    border-color: rgba(255, 215, 0, 0.5);
    /* Yellow Border */
    font-weight: bold;
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.05);
    z-index: 1;
    /* Bring above sibling borders */
}

/* --- Search --- */
.iv2-search input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    width: 200px;
    font-size: 0.9rem;
    outline: none;
    transition: width 0.3s ease;
}

.iv2-search input:focus {
    border-color: var(--accent);
    width: 250px;
}

/* --- Timeframes --- */
.iv2-timeframes {
    display: flex;
    background: var(--bg-secondary);
    padding: 2px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.iv2-tf-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.iv2-tf-btn:hover {
    color: var(--text-primary);
}

.iv2-tf-btn.active {
    background: var(--bg-tertiary);
    /* or a slight highlight */
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Reload button removed */

/* --- Content Grid --- */
.iv2-content-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-content: start;
}

.iv2-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.iv2-settings-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.2rem;
}

.iv2-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.iv2-settings-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
}

.iv2-settings-header p {
    margin: 0.3rem 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.iv2-history-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.iv2-history-filter-btn,
.iv2-settings-reset-all-btn,
.iv2-fee-reset-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.iv2-history-filter-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.iv2-history-filter-btn:hover,
.iv2-settings-reset-all-btn:hover,
.iv2-fee-reset-btn:hover {
    border-color: var(--accent);
}

.iv2-history-filter-btn.active {
    background: rgba(0, 242, 234, 0.08);
    color: var(--accent);
    border-color: rgba(0, 242, 234, 0.35);
}

.iv2-settings-reset-all-btn,
.iv2-fee-reset-btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.iv2-settings-note {
    margin-bottom: 0.85rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.iv2-fees-table-wrap {
    overflow-x: auto;
}

.iv2-fees-table {
    width: 100%;
    border-collapse: collapse;
}

.iv2-fees-table th,
.iv2-fees-table td {
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.iv2-fees-table th {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.iv2-fees-table tbody tr:last-child td {
    border-bottom: none;
}

.iv2-fee-row-custom {
    background: rgba(255, 215, 0, 0.04);
}

.iv2-fee-exchange {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-primary);
    font-weight: 600;
}

.iv2-fee-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.42rem;
    border-radius: 999px;
    background: rgba(255, 215, 0, 0.14);
    color: #ffd86b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.iv2-fee-badge-muted {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.iv2-fee-input {
    width: 100%;
    min-width: 92px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
}

.iv2-fee-input:focus {
    outline: none;
    border-color: var(--accent);
}

.iv2-fee-action-cell {
    width: 1%;
    white-space: nowrap;
}

.iv2-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-secondary);
}

/* --- Strategy Card --- */
.iv2-card {
    background: rgba(255, 255, 255, 0.03);
    /* Glassmorphism base */
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 0.8rem;
    /* Reduced side padding from 1.25rem to maximize inner space */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.iv2-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

/* Card Header */
.iv2-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.iv2-asset-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.iv2-asset-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* APR Display */
.iv2-apr-display {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    padding: 0.5rem 0;
    font-family: 'Inter', sans-serif;
    /* Clean font */
}

.iv2-apr-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: -5px;
}

/* Legs (Strategy) */
.iv2-strategy-pair {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 0.85rem 0.4rem;
    /* Reduced horizontal padding to give more width to legs */
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0.3rem;
    /* Reduced gap between leg blocks */
    font-size: 0.85rem;
    width: 100%;
    box-sizing: border-box;
}

.iv2-leg {
    padding: 6px 2px;
    /* Minimum internal side padding */
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    /* Removed gap to pull lines closer */
    flex: 1 1 0px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.iv2-leg-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    font-weight: 600;
    /* Medium-bold for Long/Short text */
    color: #333333;
    /* Dark grey instead of pure black */
}

.iv2-leg-bottom {
    margin-top: -2px;
    /* Pull text closer to the arrow row */
    font-size: 1em;
    font-weight: 600;
    /* Match top weight */
    color: #333333;
    /* Match top color */
    opacity: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Slice long names like Variational if they push boundaries */
    width: 100%;
    display: block;
}

.iv2-leg.short {
    color: var(--red);
    background: rgba(255, 59, 48, 0.2);
}

.iv2-leg.long {
    color: var(--green);
    background: rgba(52, 199, 89, 0.2);
}

/* Icon Replacement for Emojis */
.iv2-icon-dot {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 0;
    border: none;
    margin-right: 4px;
    background-color: transparent;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.iv2-icon-dot.long {
    background-image: url('../img/arrow_long.png');
    transform: translateY(-1px) scale(1.1);
}

.iv2-icon-dot.short {
    background-image: url('../img/arrow_short.png');
    transform: translateY(1px) scale(1.2);
    /* Slightly increased size */
}

/* Exec Button */
.iv2-exec-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    /* Hidden by default per design preference? Or shown? Let's show on hover or always */
    transform: translateY(10px);
    transition: all 0.2s;
}

.iv2-card:hover .iv2-exec-btn {
    opacity: 1;
    transform: translateY(0);
}

/* --- Modal --- */
.iv2-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iv2-modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 1300px;
    height: 85%;
    border-radius: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.iv2-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

.iv2-modal-close:hover {
    color: var(--text-primary);
}

#iv2ModalBody {
    padding: 2rem 2rem 1rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Colors Utilities (fallback) */
.text-long {
    color: var(--green, #34c759);
}

.text-short {
    color: var(--red, #ff3b30);
}

/* --- Infinity Tooltip --- */
.iv2-inf-tooltip-container {
    position: static;
    display: inline-block;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    color: inherit;
    /* Blend seamlessly with the text */
    margin-left: 2px;
    outline: none;
    /* Remove focus outline */
}

/* Show tooltip when clicking the infinity icon (which gains focus attributes) */
.iv2-inf-tooltip-container:focus .iv2-inf-tooltip,
.iv2-inf-tooltip-container:focus-within .iv2-inf-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.iv2-inf-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 25px;
    /* Center top of the modal */
    bottom: auto;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: 500px;
    /* Horizontal rectangle */
    max-width: 90vw;
    background: #36454F;
    /* Gris anthracite */
    color: #FFFFFF;
    /* Blanc */
    text-align: center;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    border: 2px solid #2B3740;
    /* Gris border */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    /* Soft shadow for light/dark theme visibility */
    z-index: 1001;
    font-size: 0.85rem;
    font-weight: normal;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    pointer-events: none;
    white-space: normal;
    line-height: 1.5;
}

.iv2-inf-tooltip-ref {
    font-size: 0.9em;
    font-style: italic;
    color: #D3D3D3;
}

/* Caret/Arrow pointing UP */


.iv2-inf-tooltip-link {
    color: #00f2ea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.iv2-inf-tooltip-link:hover {
    color: #FFFFFF;
}

@media (max-width: 960px) {
    .iv2-controls {
        flex-wrap: wrap;
    }

    .iv2-header {
        flex-direction: column;
        align-items: stretch;
    }

    .iv2-search input,
    .iv2-search input:focus {
        width: 100%;
    }

    .iv2-settings-toggle-btn {
        align-self: flex-start;
    }

    .iv2-body {
        flex-direction: column;
    }

    .iv2-sidebar {
        width: 100%;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 0.75rem;
    }

    .iv2-settings-header {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ═══════════════════════════════════════════════
   V5 SCORING ENHANCEMENTS
   ═══════════════════════════════════════════════ */

/* --- Mode Selector --- */
.iv2-mode-selector {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
}

/* --- Sort Dropdown --- */
.iv2-sort-select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ccc;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}
.iv2-sort-select:hover {
    border-color: rgba(255, 255, 255, 0.25);
}
.iv2-sort-select:focus {
    border-color: var(--accent);
}

/* --- Score Ring (card top-right) --- */
.iv2-score-ring {
    margin-left: auto;
    flex-shrink: 0;
}

/* --- Card Regime Border (applied via inline style) --- */

/* --- L-APR Subtitle --- */
.iv2-lapr-subtitle {
    text-align: center;
    font-size: 0.72rem;
    color: #999;
    margin-top: -2px;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

/* --- Card Bottom Metric Strip --- */
.iv2-card-metrics {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px 2px;
    font-size: 0.7rem;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 4px;
}
.iv2-card-metrics span {
    white-space: nowrap;
}

/* --- Warning Dot --- */
.iv2-warning-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #FFB800;
    border-radius: 50%;
    margin-left: 5px;
    vertical-align: middle;
    cursor: help;
}

/* --- Dashboard Summary Strip --- */
.iv2-dashboard-summary {
    display: flex;
    gap: 1.5rem;
    padding: 8px 14px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 0.78rem;
    color: #aaa;
    grid-column: 1 / -1;
}
.iv2-dashboard-summary span {
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   PHASE 2 — MODAL STATS ROW & WARNINGS
   ═══════════════════════════════════════════════ */

.iv2-modal-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 10px 14px;
    margin: 10px 0 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.iv2-stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.iv2-stat-label {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iv2-stat-value {
    font-size: 0.85rem;
    font-weight: 600;
}

.iv2-modal-warnings {
    padding: 6px 14px;
    margin-bottom: 8px;
    background: rgba(255, 184, 0, 0.12);
    border: 1px solid rgba(255, 184, 0, 0.3);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #FFB800;
}

/* ═══════════════════════════════════════════════
   PHASE 3 — SIDEBAR FILTERS (REGIME + SCORE)
   ═══════════════════════════════════════════════ */

.iv2-regime-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.iv2-regime-chip {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--chip-color, #666);
    background: transparent;
    color: var(--chip-color, #ccc);
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s;
}

.iv2-regime-chip.active {
    opacity: 1;
    background: color-mix(in srgb, var(--chip-color) 15%, transparent);
}

.iv2-score-presets {
    display: flex;
    gap: 4px;
}

.iv2-score-preset {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: #aaa;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.iv2-score-preset.active {
    background: rgba(0, 242, 234, 0.15);
    border-color: rgba(0, 242, 234, 0.4);
    color: #00f2ea;
}

/* ═══════════════════════════════════════════════
   PHASE 3 — DEEP DIVE SECTION
   ═══════════════════════════════════════════════ */

.iv2-deep-dive {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 8px;
}

.iv2-deep-dive-toggle {
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #aaa;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

.iv2-deep-dive-toggle::before {
    content: '\25BC ';
    font-size: 0.7rem;
    transition: transform 0.2s;
    display: inline-block;
}

.iv2-deep-dive-toggle.open::before {
    transform: rotate(180deg);
}

.iv2-deep-dive-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
}

.iv2-deep-dive-content {
    margin-top: 10px;
}

/* Deep Dive Tabs */
.iv2-dd-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 2px;
}

.iv2-dd-tab {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.iv2-dd-tab.active {
    background: rgba(0, 242, 234, 0.12);
    color: #00f2ea;
}

.iv2-dd-tab:hover:not(.active) {
    color: #ccc;
}

/* Scoring Tab */
.iv2-dd-scoring-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    align-items: start;
}

.iv2-dd-radar-wrap {
    display: flex;
    justify-content: center;
}

.iv2-dd-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.iv2-dd-bar-row {
    display: grid;
    grid-template-columns: 80px 1fr 55px 35px;
    gap: 8px;
    align-items: center;
    font-size: 0.78rem;
}

.iv2-dd-bar-label {
    color: #aaa;
}

.iv2-dd-bar-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.iv2-dd-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.iv2-dd-bar-value {
    text-align: right;
    color: #ccc;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.72rem;
}

.iv2-dd-bar-weight {
    text-align: right;
    color: #666;
    font-size: 0.68rem;
}

.iv2-dd-composite {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    font-weight: 700;
    color: #00f2ea;
    text-align: right;
}

/* Execution Tab */
.iv2-dd-exec-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.iv2-dd-scenario-card {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.iv2-dd-scenario-card-tight {
    margin-bottom: 10px;
    padding: 10px 12px;
}

.iv2-dd-scenario-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.iv2-dd-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f4f4f4;
}

.iv2-dd-section-subtitle {
    margin-top: 3px;
    font-size: 0.76rem;
    color: #9b9b9b;
    line-height: 1.4;
}

.iv2-dd-scenario-select-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #8f8f8f;
}

.iv2-dd-scenario-select {
    min-width: 150px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(10, 10, 10, 0.75);
    color: #f2f2f2;
}

.iv2-dd-disclaimer {
    margin-bottom: 12px;
    padding: 8px 10px;
    border-left: 3px solid rgba(255, 215, 0, 0.7);
    background: rgba(255, 215, 0, 0.08);
    color: #d5d5d5;
    font-size: 0.76rem;
    line-height: 1.45;
}

.iv2-dd-exec-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.iv2-dd-summary-card {
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.iv2-dd-summary-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8f8f8f;
}

.iv2-dd-summary-value {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #f3f3f3;
}

.iv2-dd-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.iv2-dd-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.iv2-dd-badge-ok {
    background: rgba(52, 199, 89, 0.12);
    color: #5fdd86;
}

.iv2-dd-badge-warn {
    background: rgba(255, 215, 0, 0.12);
    color: #ffdb55;
}

.iv2-dd-badge-danger {
    background: rgba(255, 59, 48, 0.12);
    color: #ff7b73;
}

.iv2-dd-leg-card {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.iv2-dd-leg-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.iv2-dd-leg-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.78rem;
    color: #bbb;
}

.iv2-dd-leg-row span:last-child {
    font-family: 'SF Mono', 'Consolas', monospace;
    color: #ddd;
}

.iv2-dd-exec-combined {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #aaa;
    text-align: center;
}

/* Modes Tab */
.iv2-dd-modes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.iv2-dd-modes-table th,
.iv2-dd-modes-table td {
    padding: 6px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.iv2-dd-modes-table th {
    color: #888;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
}

.iv2-dd-modes-table td:first-child {
    text-align: left;
    color: #aaa;
}

.iv2-dd-modes-table td {
    color: #ccc;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.76rem;
}

.iv2-dd-cell-sub {
    margin-top: 4px;
    font-size: 0.68rem;
    color: #8d8d8d;
    font-family: inherit;
}

.iv2-dd-best-mode {
    background: rgba(0, 242, 234, 0.06);
    color: #00f2ea !important;
}

.iv2-dd-loading {
    text-align: center;
    color: #888;
    padding: 20px;
    font-size: 0.85rem;
}

/* Responsive: collapse scoring layout on narrow modal */
@media (max-width: 700px) {
    .iv2-dd-scoring-layout {
        grid-template-columns: 1fr;
    }
    .iv2-dd-scenario-head {
        flex-direction: column;
    }
    .iv2-dd-exec-layout {
        grid-template-columns: 1fr;
    }
    .iv2-dd-exec-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}
