/* Compare page — workspace, table, metric bars */

.compare-workspace-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.4);
}

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

.compare-ticker-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.compare-ticker-pill {
    display: inline-flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    max-width: 100%;
    height: 26px;
    padding: 0 1px 0 8px;
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.22);
    line-height: 1;
    flex: 0 0 auto;
}

.compare-ticker-pill__link {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9rem;
}

.compare-ticker-pill__link:hover {
    text-decoration: underline;
}

.compare-ticker-pill .compare-remove-ticker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    min-width: 22px !important;
    min-height: 22px !important;
    margin: 0;
    padding: 0 !important;
    border: none !important;
    border-radius: 4px;
    background: transparent !important;
    color: rgba(148, 163, 184, 0.75);
    font-size: 0.6875rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.compare-ticker-pill .compare-remove-ticker:hover,
.compare-ticker-pill .compare-remove-ticker:focus-visible {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    outline: none;
}

.compare-empty-state {
    text-align: center;
    padding: 48px 24px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.35);
}

.compare-empty-icon {
    font-size: 2.25rem;
    margin-bottom: 12px;
    opacity: 0.45;
    color: var(--text-secondary);
}

.compare-empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.compare-empty-state p {
    margin: 0 0 16px;
    color: var(--text-secondary);
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.compare-empty-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.compare-visuals-toolbar {
    margin-bottom: 12px;
}

.compare-results-panel {
    margin-top: 4px;
}

.compare-error-state {
    text-align: center;
    padding: 40px 24px;
}

.compare-error-state h3 {
    margin: 0 0 8px;
}

.compare-error-state p {
    margin: 0;
    color: var(--error-color);
}

.compare-copy-status {
    font-size: 0.78rem;
    color: var(--success-color);
    min-height: 1.2em;
}

.compare-visuals-toolbar {
    margin-bottom: 12px;
}
.compare-recent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.compare-recent-row[hidden] {
    display: none !important;
}
.compare-recent-label {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(148, 163, 184, 0.92);
    padding-top: 7px;
}
.compare-recent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 32px;
}
.compare-recent-chip {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    max-width: 100%;
    line-height: 1.3;
}
.compare-recent-chip.compare-recent-chip--active {
    border-color: rgba(96, 165, 250, 0.65);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}
.compare-bars-collapsed .compare-solo-row,
.compare-bars-collapsed .compare-bar-row {
    display: none !important;
}
.compare-warning {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
    color: rgba(253, 224, 171, 0.95);
    font-size: 0.88rem;
}
.compare-table-wrap {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    -webkit-overflow-scrolling: touch;
}

.compare-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.compare-col-metric {
    width: min(220px, 38vw);
}

.compare-col-value {
    width: auto;
}

.compare-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: rgb(22, 32, 48);
    vertical-align: bottom;
    font-size: 0.8125rem;
}

.compare-table thead th:first-child {
    text-align: left;
    left: 0;
    z-index: 3;
}

.compare-table .th-ticker {
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1.25;
}

.compare-table .th-ticker a {
    color: inherit;
    text-decoration: none;
}

.compare-table .th-ticker a:hover {
    text-decoration: underline;
}

.compare-table .th-sub {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.3;
}

.compare-table .th-sub--error {
    color: var(--error-color);
}

.compare-table tbody tr:not(.compare-section-row):hover .compare-metric-cell,
.compare-table tbody tr:not(.compare-section-row):hover .compare-value-cell {
    background: rgba(148, 163, 184, 0.04);
}

.compare-table tbody tr:not(.compare-section-row) .compare-metric-cell,
.compare-table tbody tr:not(.compare-section-row) .compare-value-cell {
    transition: background 0.12s ease;
}

.compare-section-row td {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(147, 197, 253, 0.95);
    background: rgba(30, 41, 59, 0.65);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.compare-metric-cell {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
    line-height: 1.35;
}

.compare-metric-cell-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 24px;
}

.compare-metric-cell .m-label {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.compare-metric-cell .info-trigger {
    flex-shrink: 0;
    min-width: 24px;
    min-height: 24px;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0 !important;
    font-size: 0.75rem;
}

.compare-value-cell {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
    position: relative;
}
.compare-cell-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    width: 100%;
    min-height: 1.35em;
}

.compare-cell-value {
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
    line-height: 1.35;
    word-break: break-word;
}

.compare-badge {
    display: inline-block;
    margin-top: 2px;
}
/* First strip spacing from number/badge; second strip spaced farther below first */
.compare-bar-row {
    width: 100%;
    max-width: 112px;
    margin-top: 10px;
    flex-shrink: 0;
    cursor: help;
}
.compare-bar-row + .compare-bar-row {
    margin-top: 14px;
}
.compare-bar-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(148, 163, 184, 0.95);
    margin-bottom: 4px;
    text-align: center;
    line-height: 1.2;
}
.compare-bar-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(71, 85, 105, 0.85);
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.compare-bar-track > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    min-width: 0;
    box-sizing: border-box;
    border-right: 1px solid rgba(15, 23, 42, 0.35);
}
/* Reference band: blue family only — visually distinct from solo rainbow */
.compare-bar-track--band > span {
    transition: width 0.2s ease, background 0.2s ease;
}
.compare-bar-score-mini {
    display: block;
    font-size: 0.58rem;
    font-weight: 500;
    color: rgba(148, 163, 184, 0.88);
    margin-top: 4px;
    line-height: 1.2;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
/* Intrinsic “solo” read: bad ← … → good */
.compare-solo-row {
    width: 100%;
    max-width: 118px;
    margin-top: 8px;
    flex-shrink: 0;
    cursor: help;
}
.compare-solo-track-wrap {
    position: relative;
    width: 100%;
    margin-top: 2px;
}
.compare-solo-track {
    height: 11px;
    border-radius: 999px;
    background: linear-gradient(90deg,
        #dc2626 0%,
        #ea580c 22%,
        #eab308 44%,
        #fde047 58%,
        #bef264 76%,
        #22c55e 100%);
    border: 1px solid rgba(15, 23, 42, 0.65);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.compare-solo-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 17px;
    margin-left: -2px;
    background: #f8fafc;
    border-radius: 2px;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.95), 0 1px 4px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}
.compare-solo-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.55rem;
    color: rgba(148, 163, 184, 0.75);
    margin-top: 3px;
    letter-spacing: 0.02em;
}
.compare-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    letter-spacing: 0.04em;
}
.compare-badge-best {
    background: rgba(34, 197, 94, 0.22);
    color: rgb(134, 239, 172);
    border: 1px solid rgba(34, 197, 94, 0.35);
}
.compare-badge-warn {
    background: rgba(248, 113, 113, 0.15);
    color: rgb(252, 165, 165);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.compare-legend {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(15, 23, 42, 0.35);
    font-size: 0.8125rem;
}

.compare-legend summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
}

.compare-legend summary::-webkit-details-marker {
    display: none;
}

.compare-legend ul {
    margin: 8px 0 0;
    padding-left: 1.15rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.compare-legend li + li {
    margin-top: 4px;
}

@media (max-width: 768px) {
    .compare-workspace-toolbar {
        padding: 8px 10px;
    }

    .compare-ticker-pill {
        height: 32px;
        flex: 0 1 auto;
        max-width: none;
    }

    .compare-ticker-pill .compare-remove-ticker {
        width: 28px;
        height: 28px;
        min-width: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
    }

    .compare-workspace-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .compare-col-metric {
        width: min(140px, 42vw);
    }
}
