.page-view[hidden] {
  display: none;
}

.view-tabs {
  min-height: 58px;
  padding: 0 clamp(16px, 3vw, 40px);
  display: flex;
  gap: 30px;
  align-items: stretch;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.view-tab {
  position: relative;
  min-width: 150px;
  padding: 10px 2px 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.view-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: transparent;
}

.view-tab span {
  display: block;
  color: inherit;
  font-size: 15px;
  font-weight: 750;
}

.view-tab small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.view-tab small b {
  color: inherit;
  font-weight: 750;
}

.view-tab:hover span,
.view-tab.active span {
  color: var(--blue);
}

.view-tab.active::after {
  background: var(--blue);
}

.research-head {
  min-height: 92px;
  padding: 2px 2px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.research-head h2 {
  margin: 2px 0 5px;
  font-size: 25px;
}

.research-head > div > p:last-child {
  max-width: 790px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.secondary-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.secondary-button:disabled {
  opacity: .62;
  cursor: wait;
}

.gate-band {
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(310px, .9fr) minmax(520px, 1.4fr);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid #7b8795;
  border-radius: 5px;
  overflow: hidden;
}

.gate-band.passed {
  border-left-color: var(--green);
}

.gate-band.blocked {
  border-left-color: var(--red);
}

.gate-copy {
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.gate-dot {
  width: 11px;
  height: 11px;
  margin-top: 7px;
  flex: 0 0 11px;
  border-radius: 50%;
  background: #7b8795;
}

.gate-band.passed .gate-dot {
  background: var(--green);
}

.gate-band.blocked .gate-dot {
  background: var(--red);
}

.gate-label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.gate-copy h3 {
  margin: 0;
  font-size: 19px;
}

.gate-copy > div > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.gate-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(105px, 1fr)) minmax(190px, 1.5fr);
  border-left: 1px solid var(--line);
}

.gate-metrics > div {
  min-width: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
}

.gate-metrics > div:first-child {
  border-left: 0;
}

.gate-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.gate-metrics strong {
  margin-top: 7px;
  font-size: 18px;
  line-height: 1.35;
}

.gate-leaders strong {
  font-size: 13px;
}

.evidence-band,
.swing-ranking,
.swing-detail {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}

.research-section-heading {
  min-height: 64px;
}

.condition-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(145px, 1fr));
  border-top: 0;
  overflow-x: auto;
}

.condition-cell {
  min-width: 145px;
  min-height: 102px;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-top: 3px solid #a5aeb9;
}

.condition-cell:last-child {
  border-right: 0;
}

.condition-cell.candidate {
  border-top-color: var(--amber);
}

.condition-cell.negative {
  border-top-color: var(--red);
}

.condition-cell.warning {
  border-top-color: #b07a17;
}

.condition-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.condition-title strong {
  font-size: 14px;
}

.condition-stats {
  margin-top: 12px;
  display: grid;
  gap: 5px;
}

.condition-stats span {
  color: var(--muted);
  font-size: 11px;
}

.condition-stats b {
  color: var(--ink);
}

.research-badge {
  display: inline-flex;
  max-width: 100%;
  padding: 4px 6px;
  border-radius: 4px;
  background: #edf1f5;
  color: #566274;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}

.research-badge.candidate {
  background: var(--amber-soft);
  color: var(--amber);
}

.research-badge.negative {
  background: var(--red-soft);
  color: var(--red);
}

.research-badge.warning {
  background: #fff0dc;
  color: #966015;
}

.swing-toolbar {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 200px));
  gap: 9px;
}

.swing-toolbar input,
.swing-toolbar select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

.swing-toolbar input:focus,
.swing-toolbar select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px #2467a91c;
}

.swing-workspace {
  display: grid;
  grid-template-columns: minmax(730px, 1.55fr) minmax(350px, .7fr);
  gap: 14px;
  align-items: start;
}

.swing-ranking,
.swing-detail {
  margin-top: 14px;
}

.swing-detail {
  position: sticky;
  top: 14px;
  min-height: 620px;
}

.swing-table-head,
.swing-row {
  display: grid;
  grid-template-columns: minmax(168px, 1.1fr) 88px minmax(160px, 1.1fr) minmax(145px, .95fr) 100px;
  gap: 10px;
  align-items: center;
}

.swing-table-head {
  min-height: 38px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.swing-list {
  min-height: 485px;
  max-height: calc(100vh - 330px);
  overflow: auto;
}

.swing-row {
  width: 100%;
  min-height: 82px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.swing-row:last-child {
  border-bottom: 0;
}

.swing-row:hover {
  background: #f8fafc;
}

.swing-row.selected {
  background: #edf4fb;
  box-shadow: inset 3px 0 0 var(--blue);
}

.swing-row b,
.swing-row small {
  display: block;
  min-width: 0;
}

.swing-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.swing-identity > b {
  font-size: 15px;
}

.swing-day > b,
.swing-cost > b {
  font-size: 15px;
}

.swing-sector > b {
  font-size: 12px;
}

.loading-row {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.swing-detail-head {
  min-height: 78px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.swing-detail-head h2 {
  margin: 0;
  font-size: 21px;
}

.swing-detail-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.research-banner {
  padding: 12px 16px;
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: #f1f4f7;
  color: #4f5a69;
}

.research-banner.candidate {
  background: var(--amber-soft);
  color: #805200;
}

.research-banner.negative {
  background: var(--red-soft);
  color: var(--red);
}

.research-banner.warning {
  background: #fff0dc;
  color: #885716;
}

.research-banner strong {
  font-size: 12px;
}

.research-banner span {
  font-size: 12px;
  line-height: 1.5;
}

.swing-detail-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.swing-detail-section:last-child {
  border-bottom: 0;
}

.swing-detail-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.research-stat-grid,
.price-reference,
.sector-evidence {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.price-reference {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.research-stat-grid > div,
.price-reference > div,
.sector-evidence > div {
  min-width: 0;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.research-stat-grid > div:nth-child(3n),
.sector-evidence > div:nth-child(3n),
.price-reference > div:nth-child(2n) {
  border-right: 0;
}

.research-stat-grid > div:nth-last-child(-n+3),
.sector-evidence > div:nth-last-child(-n+3),
.price-reference > div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.research-stat-grid span,
.price-reference span,
.sector-evidence span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.research-stat-grid b,
.price-reference b,
.sector-evidence b {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.compact-list {
  margin: 10px 0 0;
  padding-left: 17px;
  color: #394658;
  font-size: 12px;
  line-height: 1.55;
}

.compact-list li + li {
  margin-top: 4px;
}

.risk-copy li::marker {
  color: var(--red);
}

.price-state {
  margin: 9px 0 0;
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
  background: #f2f6fa;
  color: #344154;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1160px) {
  .gate-band {
    grid-template-columns: 1fr;
  }

  .gate-metrics {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .swing-workspace {
    grid-template-columns: 1fr;
  }

  .swing-detail {
    position: static;
    min-height: 0;
  }

  .swing-list {
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .view-tabs {
    min-height: 52px;
    padding: 0 12px;
    gap: 20px;
  }

  .view-tab {
    min-width: 0;
    flex: 1;
    text-align: center;
  }

  .view-tab small {
    display: none;
  }

  .research-head {
    min-height: 0;
    padding: 4px 1px 12px;
    align-items: flex-start;
  }

  .research-head h2 {
    font-size: 21px;
  }

  .research-head > div > p:last-child {
    font-size: 12px;
  }

  .secondary-button {
    min-height: 36px;
    padding: 0 9px;
    font-size: 11px;
    white-space: normal;
  }

  .gate-copy {
    padding: 14px;
  }

  .gate-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gate-metrics > div {
    min-height: 72px;
    padding: 12px;
    border-top: 1px solid var(--line);
  }

  .gate-metrics > div:nth-child(odd) {
    border-left: 0;
  }

  .gate-metrics > div:nth-child(-n+2) {
    border-top: 0;
  }

  .condition-grid {
    grid-template-columns: repeat(7, minmax(155px, 155px));
  }

  .swing-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .swing-toolbar .search-field {
    grid-column: 1 / -1;
  }

  .swing-toolbar label:last-child {
    grid-column: 1 / -1;
  }

  .swing-table-head {
    display: none;
  }

  .swing-row {
    min-height: 118px;
    padding: 12px;
    grid-template-columns: minmax(0, 1.2fr) minmax(86px, .7fr);
    gap: 8px 12px;
  }

  .swing-condition,
  .swing-sector {
    grid-column: auto;
  }

  .swing-cost {
    display: none;
  }

  .research-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .research-stat-grid > div:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .research-stat-grid > div:nth-child(2n) {
    border-right: 0;
  }

  .research-stat-grid > div:nth-last-child(-n+3) {
    border-bottom: 1px solid var(--line);
  }

  .research-stat-grid > div:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  .swing-detail-head {
    padding: 14px;
  }

  .swing-detail-section {
    padding: 13px 14px;
  }
}

@media (max-width: 430px) {
  .research-head {
    display: block;
  }

  .secondary-button {
    margin-top: 10px;
  }

  .swing-toolbar {
    grid-template-columns: 1fr;
  }

  .swing-toolbar .search-field,
  .swing-toolbar label:last-child {
    grid-column: auto;
  }

  .sector-evidence {
    grid-template-columns: 1fr;
  }

  .sector-evidence > div {
    border-right: 0;
  }

  .sector-evidence > div:not(:last-child) {
    border-bottom: 1px solid var(--line);
  }
}
