/* Signal Lab + Market Pulse — builds on styles.css, history.css, quant.css */
.l-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: start; }
.l-hero h1 { font-size: 22px; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
.l-kpis { display: flex; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.l-kpi { background: var(--panel); padding: 10px 14px; min-width: 112px; }
.l-kpi .k { font-size: 11px; color: var(--muted); }
.l-kpi .v { font-family: var(--mono); font-size: 18px; margin-top: 2px; }
.l-warn { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 0 var(--radius) var(--radius) 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.l-warn b { color: var(--text); font-weight: 500; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; font-family: var(--sans); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.v-edge { color: var(--up); }
.v-costs { color: var(--accent); }
.v-ranks { color: #5aa9ff; }
.v-negative { color: var(--down); }
.v-none, .v-insufficient, .v-untestable { color: var(--muted); }
.v-none.pill, .v-insufficient.pill, .v-untestable.pill { font-weight: 500; border-color: var(--line-2); }

.l-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.l-legend button { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.l-legend button:hover { border-color: var(--line-2); }
.l-legend button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.l-legend .n { font-family: var(--mono); font-size: 16px; color: var(--text); }
.l-legend .d { font-size: 11px; color: var(--muted); line-height: 1.35; max-width: 190px; }

.l-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.seg { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { background: none; border: 0; color: var(--muted); padding: 4px 11px; border-radius: 6px; cursor: pointer; font-size: 12.5px; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.l-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px; align-items: start; }
.l-detail { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; }
.l-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.l-tbl th { position: static; text-align: right; color: var(--muted); font-weight: 500; font-size: 11.5px; padding: 8px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; cursor: pointer; background: transparent; }
.l-tbl th:hover { color: var(--text); }
.l-tbl th.on { color: var(--accent); }
.l-tbl th:first-child, .l-tbl td:first-child { text-align: left; }
.l-tbl td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
.l-tbl td.l-name { font-family: var(--sans); white-space: normal; min-width: 150px; }
.l-tbl td.l-name small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.l-tbl td.l-v { text-align: left; }
.l-tbl tbody tr { cursor: pointer; }
.l-tbl tbody tr:hover td { background: var(--panel-2); }
.l-tbl tbody tr.sel td { background: rgba(233,162,59,.08); }
.l-tbl tbody tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.l-tbl tr.l-sec td { background: transparent !important; cursor: default; font-family: var(--sans); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 16px; text-align: left; border-bottom-color: var(--line-2); }
.l-tbl .dim { color: var(--muted); }
.l-halves { display: inline-flex; gap: 3px; vertical-align: middle; }
.l-halves i { width: 9px; height: 9px; border-radius: 2px; background: var(--line-2); }
.l-halves i.up { background: var(--up); }
.l-halves i.down { background: var(--down); }

.l-d-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.l-d-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.l-d-head .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.l-say { font-size: 14px; line-height: 1.6; margin: 14px 0; }
.l-say b { font-weight: 600; }
.l-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 12px 0; }
.l-stats > div { background: var(--panel); padding: 9px 11px; }
.l-stats .k { font-size: 11px; color: var(--muted); }
.l-stats .v { font-family: var(--mono); font-size: 14px; margin-top: 2px; }
.l-chart { margin: 8px 0 4px; }
.l-chart svg { display: block; width: 100%; }
.l-ctitle { font-size: 12px; font-weight: 600; margin: 16px 0 2px; }
.l-cnote { font-size: 11.5px; color: var(--muted); margin: 0 0 6px; line-height: 1.45; }
.l-rule { font-family: var(--mono); font-size: 11.5px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.l-hz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 10px 0; }
.l-hz button { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 8px; cursor: pointer; text-align: left; }
.l-hz button.on { border-color: var(--accent); }
.l-hz .k { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.b-pos { fill: var(--up); fill-opacity: .8; }
.b-neg { fill: var(--down); fill-opacity: .8; }
.b-cost { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 2; }
.b-best { stroke: var(--text); stroke-width: 1.2; fill: none; }
.l-insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.l-insights h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; }
.l-insights ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.l-insights li { font-size: 13px; line-height: 1.45; display: flex; justify-content: space-between; gap: 10px; }
.l-insights li a { color: var(--text); text-decoration: none; }
.l-insights li a:hover { color: var(--accent); }
.l-insights li span { font-family: var(--mono); font-size: 12px; white-space: nowrap; }

/* Market Pulse */
.p-top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
.p-gauge { display: flex; flex-direction: column; gap: 10px; }
.p-score { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.p-score .num { font-family: var(--mono); font-size: 46px; line-height: 1; font-weight: 500; }
.p-score .lab { font-size: 18px; font-weight: 600; }
.p-bar { position: relative; height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(239,90,90,.55), rgba(138,145,156,.25) 50%, rgba(52,193,123,.55)); margin: 6px 0 2px; }
.p-bar i { position: absolute; top: -5px; width: 3px; height: 22px; background: var(--text); border-radius: 2px; transform: translateX(-50%); }
.p-bar b { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--bg); opacity: .8; }
.p-ticks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.p-odds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.p-odds > div { background: var(--panel); padding: 10px 12px; }
.p-odds > div.cur { background: var(--panel-2); box-shadow: inset 0 2px 0 var(--accent); }
.p-odds .k { font-size: 11px; color: var(--muted); }
.p-odds .v { font-family: var(--mono); font-size: 15px; margin-top: 3px; }
.p-odds .s { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.p-ind td.l-name { min-width: 180px; }
.p-zone { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); font-family: var(--sans); }
.p-zone.on { color: var(--text); border-color: var(--muted); }
.p-pct { display: inline-block; width: 46px; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.p-pct i { display: block; height: 100%; background: var(--accent); }
.p-why { font-family: var(--sans); white-space: normal !important; color: var(--muted); font-size: 12px !important; text-align: left !important; min-width: 220px; line-height: 1.4; }

@media (max-width: 1100px) {
  .l-grid { grid-template-columns: 1fr; }
  .l-detail { position: static; max-height: none; }
  .p-top { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .l-hero { grid-template-columns: 1fr; }
  .l-kpis { flex-wrap: wrap; }
  .l-kpi { flex: 1 1 40%; }
  .l-insights { grid-template-columns: 1fr; }
  .l-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .l-hide-m { display: none; }
  .p-score .num { font-size: 38px; }
}