/**
 * Fantasy Draft Board v4.0 - Trade Evaluation Modal Styles
 * 
 * Dark theme matching existing trading mode modals.
 * Responsive layout: side-by-side on desktop, stacked on mobile.
 * 
 * @version 4.1
 */

/* ============================================
   MODAL OVERLAY & CONTAINER
   ============================================ */

.te-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.82);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: teFadeIn 0.2s ease-out;
}

@keyframes teFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.te-modal {
    background: #1e293b;
    border-radius: 12px;
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    border: 1px solid #334155;
    animation: teSlideUp 0.25s ease-out;
}

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

/* ============================================
   HEADER
   ============================================ */

.te-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid #334155;
    background: linear-gradient(135deg, #1e3a5f, #0f766e);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

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

.te-header-icon {
    font-size: 1.25rem;
}

.te-header h2 {
    margin: 0;
    color: #f1f5f9;
    font-size: 1.1rem;
    font-weight: 600;
}

.te-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.15s;
}

.te-close:hover {
    color: white;
}

/* ============================================
   BODY (scrollable content)
   ============================================ */

.te-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: #475569 transparent;
}

.te-body::-webkit-scrollbar {
    width: 6px;
}

.te-body::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

/* === Strategy Selector Bar === */
.te-strategy-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
}

.te-strategy-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.te-strategy-none {
    font-size: 0.8rem;
    color: #6b7280;
    font-style: italic;
}

.te-strategy-select {
    flex: 1;
    min-width: 120px;
    max-width: 240px;
    padding: 0.3rem 0.5rem;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

.te-strategy-select:hover {
    border-color: #7c3aed;
}

.te-strategy-reeval-btn {
    padding: 0.3rem 0.7rem;
    background: #7c3aed;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.te-strategy-reeval-btn:hover {
    background: #6d28d9;
}

.te-strategy-edit-btn,
.te-strategy-create-btn {
    padding: 0.3rem 0.5rem;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #475569;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.te-strategy-edit-btn:hover,
.te-strategy-create-btn:hover {
    color: #a78bfa;
    border-color: #7c3aed;
}

.te-strategy-create-btn {
    font-weight: 600;
    color: #a78bfa;
}

/* === Trade Builder Tabs === */
.te-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 1rem;
    background: rgba(0, 0, 0, 0.15);
}

.te-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.te-tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.03);
}

.te-tab.active {
    color: white;
    border-bottom-color: var(--primary-start, #667eea);
}

/* Highlight tab when trade is lopsided */
.te-tab-highlight {
    color: #f97316 !important;
}

.te-tab-highlight.active {
    border-bottom-color: #f97316;
}

.te-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f97316;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Tab panels -- only active is visible */
.te-tab-panel {
    display: none;
}

.te-tab-panel.active {
    display: block;
}

/* === Improve Trade Tab === */
.te-improve-placeholder {
    text-align: center;
    padding: 3rem 2rem;
    color: rgba(255, 255, 255, 0.6);
}

.te-improve-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.te-improve-placeholder h3 {
    color: white;
    margin-bottom: 0.5rem;
}

.te-improve-content {
    padding: 1rem 0;
}

.te-improve-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.te-improve-header h3 {
    color: white;
    margin: 0 0 0.5rem 0;
}

/* "Value gap: X in favor of Y" line */
.te-improve-header p {
    color: #e2e8f0;
    font-size: 0.9rem;
}

.te-improve-header p strong {
    color: #f59e0b;
}

.te-improve-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.25rem;
}

.te-suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.te-suggestion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    transition: background 0.2s;
}

.te-suggestion-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.te-suggestion-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.te-suggestion-name {
    font-weight: 500;
    color: white;
}

.te-suggestion-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.te-suggestion-val {
    font-weight: 600;
    color: white;
}

.te-suggestion-gap {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Add to Trade button on improve tab suggestions */
.te-suggestion-item {
    flex-wrap: wrap;
}

.te-suggestion-add-btn {
    background: transparent;
    color: #a78bfa;
    border: 1px solid #7c3aed;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    margin-left: auto;
}

.te-suggestion-add-btn:hover {
    background: #7c3aed;
    color: white;
}

.te-suggestion-add-btn.te-suggestion-added {
    background: #064e3b;
    color: #10b981;
    border-color: #10b981;
    cursor: default;
}

.te-suggestion-add-btn:disabled {
    opacity: 0.8;
}

.te-improve-also {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.te-improve-tips {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.te-value-context {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 0.5rem;
}

/* ============================================
   ROS VALUE BADGES
   ============================================ */

.te-ros-badge {
    font-size: 0.6rem;
    font-weight: 600;
    color: #94a3b8;
    background: rgba(100, 116, 139, 0.12);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 3px;
    white-space: nowrap;
    cursor: help;
    font-variant-numeric: tabular-nums;
}

.te-ros-badge.te-ros-hot {
    color: #34d399;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.25);
}

.te-ros-badge.te-ros-cold {
    color: #f87171;
    background: rgba(239, 68, 68, 0.10);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ============================================
   LOADING STATE
   ============================================ */

.te-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 1rem;
}

.te-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #334155;
    border-top-color: #0d9488;
    border-radius: 50%;
    animation: teSpin 0.8s linear infinite;
}

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

.te-loading-text {
    color: #94a3b8;
    font-size: 0.85rem;
}

/* ============================================
   FAIRNESS GAUGE
   ============================================ */

.te-fairness {
    border: 1px solid;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.te-fairness-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.te-fairness-score {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    flex-shrink: 0;
}

.te-fairness-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.te-fairness-label {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
}

.te-fairness-info {
    flex: 1;
}

.te-fairness-verdict {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.te-fairness-desc {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* Value comparison bar */
.te-value-bar-container {
    margin-bottom: 0.5rem;
}

.te-value-bar {
    display: flex;
    height: 26px;
    border-radius: 6px;
    overflow: hidden;
    background: #0f172a;
}

.te-value-bar-left {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    transition: width 0.4s ease;
}

.te-value-bar-right {
    background: linear-gradient(90deg, #8b5cf6, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    transition: width 0.4s ease;
}

.te-value-bar-label {
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.te-fairness-delta {
    color: #94a3b8;
    font-size: 0.75rem;
    text-align: center;
}

.te-fairness-delta strong {
    color: #e2e8f0;
}

/* ============================================
   JERRYGRID(TM) FACTOR BREAKDOWN (in eval modal)
   ============================================ */

.te-jerrygrid-breakdown {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

/* Header row: branding left, composite score right (clickable to toggle) */
.te-jg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s;
}

.te-jg-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.te-jg-branding {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Reuse existing .jg-logo from extensions CSS */
.te-jg-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
}

.te-jg-composite {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.te-jg-grade {
    font-size: 1.4rem;
    font-weight: 700;
}

.te-jg-score {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Chevron toggle indicator - prominent and visible */
.te-jg-toggle {
    font-size: 0.8rem;
    color: #a78bfa;
    margin-left: 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    background: rgba(167, 139, 250, 0.15);
    border-radius: 4px;
    border: 1px solid rgba(167, 139, 250, 0.3);
    transition: background 0.15s, transform 0.2s;
}

.te-jg-header:hover .te-jg-toggle {
    background: rgba(167, 139, 250, 0.25);
}

/* Recommendation pill */
.te-jg-recommendation {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: fit-content;
    margin: 0 auto 0.5rem auto;
    font-size: 0.85rem;
}

.te-jg-rec-emoji {
    font-size: 1rem;
}

.te-jg-rec-text {
    color: #cbd5e1;
    font-weight: 500;
}

/* Subtitle explaining composite scoring */
.te-jg-subtitle {
    text-align: center;
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-style: italic;
}

/* Factor bars container - collapsible with smooth animation */
.te-jg-factors {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    max-height: 800px;
    opacity: 1;
}

.te-jg-factors.te-jg-collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

/* Factor label readability: bright white, no decoration */
.te-jerrygrid-breakdown .jg-factor-label {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    text-decoration: none;
}

/* Factor row spacing */
.te-jerrygrid-breakdown .jg-factor-header {
    margin-bottom: 0.4rem;
}

/* Factor detail chips -- override to fit eval modal context */
.te-jerrygrid-breakdown .jg-factor-row {
    padding: 0.4rem 0;
}

.te-jerrygrid-breakdown .jg-factor-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.2rem;
    padding-left: 1.6rem;
}

.te-jerrygrid-breakdown .jg-detail {
    font-size: 0.7rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Factor help (?) icon */
.te-jerrygrid-breakdown .jg-factor-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 50%;
    cursor: pointer;
    margin-left: 0.25rem;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.te-jerrygrid-breakdown .jg-factor-help:hover {
    background: rgba(167, 139, 250, 0.25);
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.5);
}

/* Factor help expanded text */
.te-jerrygrid-breakdown .jg-factor-help-text {
    font-size: 0.72rem;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.8);
    border-left: 2px solid #a78bfa;
    padding: 0.4rem 0.6rem;
    margin: 0.2rem 0 0.3rem 1.6rem;
    border-radius: 4px;
    line-height: 1.45;
}
.te-jerrygrid-breakdown .jg-factor-help-text.hidden {
    display: none;
}

/* Importance hint (e.g. "(8/9)") next to weight percentage */
.te-jerrygrid-breakdown .jg-importance-hint {
    font-size: 0.6rem;
    color: #64748b;
    font-weight: 400;
}

/* ============================================
   TWO-COLUMN TRADE BREAKDOWN
   ============================================ */

.te-trade-columns {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
}

.te-team-col {
    flex: 1;
    min-width: 0;
}

.te-team-left {
    padding-right: 0.75rem;
}

.te-team-right {
    padding-left: 0.75rem;
}

/* Center divider */
.te-center-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0 0.25rem;
    flex-shrink: 0;
    width: 36px;
}

.te-arrow {
    font-size: 1.1rem;
    color: #475569;
    font-weight: 600;
}

.te-arrow-right { color: #3b82f6; }
.te-arrow-left { color: #8b5cf6; }

.te-vs {
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Team header */
.te-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.6rem;
    background: #0f172a;
    border-radius: 8px;
    margin-bottom: 0.6rem;
}

.te-team-name {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.te-team-total {
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    background: #1e293b;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* Sections (Gives/Gets) */
.te-section {
    margin-bottom: 0.5rem;
}

.te-section-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0;
}

.te-section-icon {
    font-size: 0.75rem;
}

.te-section-icon.te-outgoing { color: #f87171; }
.te-section-icon.te-incoming { color: #34d399; }

.te-empty {
    color: #475569;
    font-size: 0.75rem;
    font-style: italic;
    padding: 0.35rem 0.5rem;
}

/* ============================================
   PLAYER CARDS
   ============================================ */

.te-player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    border: 1px solid transparent;
    transition: background 0.15s;
}

.te-player-giving {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.12);
}

.te-player-receiving {
    background: rgba(52, 211, 153, 0.06);
    border-color: rgba(52, 211, 153, 0.12);
}

.te-player-main {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
}

.te-pos-badge {
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
    min-width: 26px;
    text-align: center;
}

.te-player-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.te-player-name {
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.te-player-meta {
    color: #64748b;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.te-injury-badge {
    background: #7f1d1d;
    color: #fca5a5;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
}

/* Player value */
.te-player-value {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    margin-left: 0.25rem;
}

.te-value-number {
    color: #e2e8f0;
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.te-value-number.te-estimated {
    color: #94a3b8;
    font-style: italic;
}

.te-trend {
    font-size: 0.65rem;
    font-weight: 700;
}

.te-trend-up { color: #34d399; }
.te-trend-down { color: #f87171; }

.te-rank {
    color: #64748b;
    font-size: 0.6rem;
    font-weight: 500;
}

/* ============================================
   ASSET CARDS
   ============================================ */

.te-asset-card {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.te-asset-giving {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.12);
}

.te-asset-receiving {
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.12);
}

.te-asset-icon {
    font-size: 0.8rem;
}

.te-asset-label {
    color: #cbd5e1;
    flex: 1;
}

.te-asset-dir {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.te-asset-dir.te-giving {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.te-asset-dir.te-receiving {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

/* ============================================
   POSITION IMPACT
   ============================================ */

.te-position-impact {
    padding: 0.75rem 0;
    border-top: 1px solid #1e293b;
    margin-bottom: 0.5rem;
}

.te-section-title {
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.te-impact-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.te-impact-team {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.te-impact-team-name {
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.te-impact-badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.te-impact-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    border: 1px solid;
    background: rgba(15, 23, 42, 0.5);
    font-size: 0.7rem;
}

.te-impact-pos {
    font-weight: 700;
    font-size: 0.65rem;
}

.te-impact-net {
    font-weight: 600;
}

.te-impact-positive .te-impact-net { color: #34d399; }
.te-impact-negative .te-impact-net { color: #f87171; }
.te-impact-neutral .te-impact-net { color: #94a3b8; }

/* ============================================
   INSIGHTS
   ============================================ */

.te-insights {
    padding: 0.75rem 0;
    border-top: 1px solid #1e293b;
}

.te-insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.te-insight {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.35;
}

.te-insight-warning {
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.15);
}

.te-insight-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.te-insight-positive {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.12);
}

.te-insight-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    line-height: 1.35;
}

.te-insight-text {
    color: #cbd5e1;
}

/* ============================================
   FOOTER
   ============================================ */

.te-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid #334155;
    background: #0f172a;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.te-footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.te-value-source {
    color: #64748b;
    font-size: 0.7rem;
}

.te-footer-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.te-btn {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s, color 0.15s;
}

.te-btn-secondary {
    background: #334155;
    color: #e2e8f0;
}

.te-btn-secondary:hover {
    background: #475569;
}

.te-btn-primary {
    background: #0d9488;
    color: white;
}

.te-btn-primary:hover {
    background: #0f766e;
}

.te-btn-save {
    background: #7c3aed;
    color: white;
}

.te-btn-save:hover {
    background: #6d28d9;
}

.te-btn-save:disabled {
    background: #4c1d95;
    opacity: 0.7;
    cursor: default;
}

/* ============================================
   MULTI-TEAM LAYOUT (3+ teams)
   ============================================ */

.te-multi-team {
    padding: 0.5rem 0;
}

.te-multi-header {
    text-align: center;
    margin-bottom: 0.75rem;
}

.te-multi-label {
    background: #0f172a;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 99px;
}

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

.te-multi-team-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
    .te-modal-overlay {
        padding: 0.5rem;
    }
    
    .te-modal {
        max-height: 95vh;
        border-radius: 10px;
    }
    
    .te-header {
        padding: 0.65rem 0.85rem;
        border-radius: 10px 10px 0 0;
    }
    
    .te-header h2 {
        font-size: 0.95rem;
    }
    
    .te-body {
        padding: 0.75rem 0.85rem;
    }
    
    /* Stack trade columns vertically on mobile */
    .te-trade-columns {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .te-team-left,
    .te-team-right {
        padding: 0;
    }
    
    .te-center-divider {
        flex-direction: row;
        width: auto;
        padding: 0.35rem 0;
        gap: 0.5rem;
    }
    
    .te-fairness-top {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .te-impact-team {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .te-impact-team-name {
        min-width: auto;
    }
    
    .te-footer {
        padding: 0.5rem 0.85rem;
        border-radius: 0 0 10px 10px;
    }
    
    .te-multi-grid {
        grid-template-columns: 1fr;
    }
    
    /* JerryGrid breakdown mobile */
    .te-jg-header {
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
    }
    
    .te-jerrygrid-breakdown {
        padding: 0.65rem 0.75rem;
    }
    
    .te-jerrygrid-breakdown .jg-factor-details {
        padding-left: 0;
    }
}
