/* Upset Index — component styles layered on top of the Market Limits Tailwind tokens. */

.ui-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.55rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #cbd5e1;
    background: transparent;
    border: 1px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
    cursor: pointer;
    white-space: nowrap;
}
.ui-tab:hover { color: #34d399; background: rgba(6, 78, 59, .35); }
.ui-tab[aria-selected="true"] {
    color: #071a14;
    background: #10b981;
    border-color: #10b981;
}
.ui-tab .tab-dot { width: .4rem; height: .4rem; border-radius: 999px; background: #f59e0b; }
.ui-tab[aria-selected="true"] .tab-dot { background: #071a14; }
.ui-tab[disabled] { opacity: .45; cursor: not-allowed; }

.filter-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 0.4rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .55rem;
    border-radius: .45rem;
    font-size: .75rem;
    font-weight: 600;
    color: #cbd5e1;
    background: #071a14;
    border: 1px solid rgba(16, 185, 129, .25);
    cursor: pointer;
    transition: background-color .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: rgba(52, 211, 153, .6); color: #34d399; }
.chip[aria-pressed="true"] { background: rgba(6, 78, 59, .9); border-color: #34d399; color: #6ee7b7; }
.chip[aria-pressed="false"] { opacity: .55; }

.seg {
    display: inline-flex;
    padding: 2px;
    border-radius: .5rem;
    background: #071a14;
    border: 1px solid rgba(16, 185, 129, .25);
}
.seg button {
    padding: .25rem .6rem;
    font-size: .75rem;
    font-weight: 600;
    color: #94a3b8;
    border-radius: .35rem;
    cursor: pointer;
}
.seg button[aria-pressed="true"] { background: #164e3c; color: #6ee7b7; }

.field-input {
    width: 100%;
    background: #071a14;
    border: 1px solid rgba(16, 185, 129, .25);
    border-radius: .5rem;
    padding: .4rem .55rem;
    font-size: .8125rem;
    color: #e2e8f0;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.field-input::-webkit-calendar-picker-indicator { filter: invert(.8); }

.range-input { width: 100%; accent-color: #34d399; }

.stat-tile {
    border-radius: .75rem;
    padding: .55rem .8rem;
    background: linear-gradient(145deg, #0b261e 0%, #071a14 100%);
    border: 1px solid rgba(0, 230, 118, 0.12);
}
.stat-label {
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #94a3b8;
}
.stat-value {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: #f8fafc;
    line-height: 1.2;
    margin-top: .15rem;
}
.stat-note { font-size: .6875rem; color: #94a3b8; margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-note.pos { color: #6ee7b7; }
.stat-note.neg { color: #fca5a5; }

.data-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.data-table caption { text-align: left; }
.data-table th {
    text-align: right;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #94a3b8;
    padding: .5rem .6rem;
    border-bottom: 1px solid rgba(16, 185, 129, .25);
    white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table td {
    padding: .5rem .6rem;
    text-align: right;
    border-bottom: 1px solid rgba(6, 78, 59, .45);
    color: #e2e8f0;
    font-variant-numeric: tabular-nums;
}
.data-table tbody tr:hover { background: rgba(6, 78, 59, .3); }
.data-table .num { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .78125rem; }
.data-table .muted { color: #64748b; }
.data-table .bucket-name { color: #f1f5f9; font-weight: 600; text-align: left; }
.data-table .bucket-range { display: block; font-size: .6875rem; color: #94a3b8; font-weight: 500; font-family: 'JetBrains Mono', ui-monospace, monospace; }

.bar-track {
    position: relative;
    height: .4rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, .18);
    margin-top: .3rem;
    min-width: 3.5rem;
}
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: #34d399; }
.bar-fill.below { background: #fca5a5; }
.bar-mark {
    position: absolute;
    top: -3px; bottom: -3px;
    width: 2px;
    background: #cbd5e1;
    opacity: .85;
}

.chart-wrap { position: relative; }
.chart-svg { display: block; width: 100%; overflow: visible; }
.chart-axis-text { fill: #94a3b8; font-size: 10px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.chart-grid { stroke: rgba(148, 163, 184, .14); stroke-width: 1; }
.chart-ref { stroke: #94a3b8; stroke-width: 1.25; stroke-dasharray: 5 4; opacity: .8; }
.chart-ci { stroke: rgba(52, 211, 153, .5); stroke-width: 1.5; }
.chart-line { fill: none; stroke: rgba(52, 211, 153, .55); stroke-width: 1.5; }
.chart-dot { fill: #34d399; stroke: #071a14; stroke-width: 1.5; cursor: pointer; }
.chart-dot.below { fill: #fca5a5; }
.chart-dot.dim { opacity: .55; }
.chart-label { fill: #94a3b8; font-size: 9.5px; font-family: 'Inter', sans-serif; }

.chart-tooltip {
    position: absolute;
    z-index: 20;
    pointer-events: none;
    min-width: 11rem;
    padding: .55rem .65rem;
    border-radius: .55rem;
    background: rgba(4, 16, 12, .97);
    border: 1px solid rgba(52, 211, 153, .45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    font-size: .75rem;
    color: #e2e8f0;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity .12s ease;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-title { font-weight: 700; color: #6ee7b7; margin-bottom: .25rem; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: .75rem; color: #cbd5e1; }
.chart-tooltip .tt-row span:last-child { font-family: 'JetBrains Mono', ui-monospace, monospace; color: #f1f5f9; }

.mini-card { cursor: pointer; text-align: left; }
.mini-card:hover { border-color: rgba(52, 211, 153, .45); }

.pill-unavailable {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: rgba(245, 158, 11, .12);
    border: 1px solid rgba(245, 158, 11, .35);
    color: #fbbf24;
}
.pill-live {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: rgba(16, 185, 129, .12);
    border: 1px solid rgba(52, 211, 153, .35);
    color: #6ee7b7;
}

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: rgba(52, 211, 153, .3); border-radius: 999px; }

@media (max-width: 640px) {
    .stat-value { font-size: 1.1rem; }
    .data-table { font-size: .75rem; }
    .data-table th, .data-table td { padding: .4rem .35rem; }
}


/* ---------- compact tool layout ---------- */
.ui-tab span { line-height: 1; }
.ui-tab-end { margin-left: auto; }
#tabs { display: flex; align-items: center; gap: .25rem; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
#tabs::-webkit-scrollbar { display: none; }

#filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1.1rem; }
#filters[hidden] { display: none; }
.fgroup { min-width: 0; }
.fgroup .filter-label { margin-bottom: .25rem; white-space: nowrap; }
.filter-value { color: #e2e8f0; font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0; text-transform: none; font-weight: 600; margin-left: .35rem; }
.chip { padding: .2rem .5rem; font-size: .72rem; }
.reset-btn { margin-left: auto; font-size: .72rem; font-weight: 600; color: #6ee7b7; padding: .3rem .6rem; border-radius: .45rem; border: 1px solid rgba(16, 185, 129, .25); background: transparent; cursor: pointer; }
.reset-btn:hover { background: rgba(6, 78, 59, .45); }
.field-input { padding: .25rem .45rem; font-size: .75rem; }

.conf-pop { position: relative; }
.conf-pop > summary { list-style: none; cursor: pointer; display: inline-flex; gap: .4rem; }
.conf-pop > summary::-webkit-details-marker { display: none; }
.conf-panel { position: absolute; z-index: 30; top: calc(100% + .35rem); left: 0; width: min(26rem, 80vw); max-height: 16rem; overflow-y: auto; padding: .6rem; border-radius: .6rem; background: #0b261e; border: 1px solid rgba(52, 211, 153, .35); box-shadow: 0 16px 32px rgba(0, 0, 0, .5); }

.panel { border-radius: .75rem; border: 1px solid rgba(16, 185, 129, .16); background: rgba(7, 26, 20, .55); padding: .6rem .75rem .7rem; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .45rem; }
.panel-head h3 { font-size: .8125rem; font-weight: 700; color: #fff; }

.tbl-scroll { max-height: 21.5rem; overflow: auto; border-radius: .4rem; }
.tbl-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.tbl-scroll::-webkit-scrollbar-thumb { background: rgba(52, 211, 153, .3); border-radius: 999px; }
.tbl-scroll thead th { position: sticky; top: 0; z-index: 1; background: #0b261e; }
.data-table.compact { font-size: .75rem; }
.data-table.compact th { padding: .3rem .5rem; font-size: .625rem; }
.data-table.compact td { padding: .28rem .5rem; }
.data-table.compact .num { font-size: .72rem; }
.data-table.compact .bucket-range { display: inline; margin-left: .4rem; font-size: .65rem; }
.data-table.compact .bar-track { display: inline-block; width: 2.6rem; min-width: 0; height: .3rem; margin-top: 0; }
.data-table .empty-row td { opacity: .6; }
.data-table.method-table td { vertical-align: top; text-align: left; }
.data-table.method-table th { text-align: left; }
.data-table.method-table td.num { text-align: left; }

.seg button { padding: .2rem .65rem; }
.mini-card { display: block; width: 100%; }
.mini-card .chart-svg { max-height: 96px; }

.method-list > div + div { margin-top: .6rem; }
.method-list dt { font-size: .75rem; font-weight: 700; color: #6ee7b7; }
.method-list dd { font-size: .78rem; line-height: 1.5; color: #cbd5e1; margin-top: .1rem; }
.method-bullets { list-style: disc; padding-left: 1.1rem; display: grid; gap: .45rem; font-size: .78rem; line-height: 1.5; color: #cbd5e1; }
.method-bullets li::marker { color: #34d399; }

@media (max-width: 640px) {
    .reset-btn { margin-left: 0; }
    .tbl-scroll { max-height: 18rem; }
}

@media (max-width: 767.98px) { .ui-tab i { display: none; } .ui-tab { padding: .4rem .6rem; } }

.data-table.compact td, .data-table.compact th { white-space: nowrap; }
.data-table th.left { text-align: left; }
.data-table.method-table td, .data-table.method-table th { white-space: normal; }
.data-table.method-table td.num { white-space: nowrap; }
