:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --soft: #f6f8fb;
  --panel: #ffffff;
  --line: #d7dfeb;
  --soft-line: #edf1f6;
  --green: #0f8a5f;
  --green-bg: #e9f7f1;
  --blue: #2457c5;
  --blue-bg: #eaf0ff;
  --amber: #8a5a00;
  --amber-bg: #fff5d6;
  --red: #b42318;
  --red-bg: #fdecec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: inherit;
}

.breakout-shell {
  min-height: 100vh;
}

.breakout-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 22px 32px 18px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}

.crumbs a {
  text-decoration: none;
}

.title-row,
.section-head,
.control-strip {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 27px;
}

h2 {
  font-size: 20px;
}

.freshness {
  min-width: 230px;
  text-align: right;
  color: var(--muted);
}

.freshness span,
.freshness strong {
  display: block;
}

.freshness strong {
  color: var(--ink);
  font-size: 16px;
  margin-top: 3px;
}

.control-strip {
  padding: 16px 32px 0;
  align-items: center;
  flex-wrap: wrap;
}

.market-tabs {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 520px;
  gap: 8px;
}

.market-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 6px 11px;
}

.market-tab[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.search-box,
.library-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 260px;
  min-width: 240px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box input,
.library-search input,
.market-cap-box input,
.market-cap-box select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 7px 10px;
}

.market-cap-box {
  display: grid;
  grid-template-columns: auto minmax(72px, 92px) minmax(108px, 124px);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.market-cap-box input {
  text-align: right;
}

.market-cap-box select {
  padding-right: 6px;
}

.analysis-strip,
.group-rank-strip {
  padding: 12px 32px 0;
}

.analysis-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.preset-filters,
.group-strip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-button,
.export-button,
.group-strip-head button,
.group-chip {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.preset-button,
.export-button,
.group-strip-head button {
  min-height: 32px;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.preset-button[aria-pressed="true"],
.group-chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.sort-box {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sort-box select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 5px 28px 5px 9px;
}

.group-rank-strip {
  display: grid;
  gap: 8px;
}

.group-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.group-chip {
  min-height: 48px;
  display: grid;
  gap: 2px;
  min-width: 170px;
  max-width: 260px;
  padding: 7px 9px;
  text-align: left;
}

.group-chip b,
.group-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-chip b {
  font-size: 12px;
}

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

.group-chip[aria-pressed="true"] span {
  color: rgba(255, 255, 255, 0.78);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 12px;
  padding: 18px 32px 4px;
}

.summary-card {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 13px 14px;
}

.summary-card span,
.summary-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
}

.summary-card b {
  display: block;
  font-size: 25px;
  line-height: 1.15;
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.workbench-section,
.framework-section,
.framework-library-section {
  padding: 18px 32px 0;
}

.section-head {
  align-items: end;
  margin-bottom: 11px;
}

.file-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.file-links a {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 9px;
  text-decoration: none;
}

.table-wrap,
.framework-grid {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.candidate-table {
  min-width: 1640px;
}

th,
td {
  border-bottom: 1px solid var(--soft-line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.candidate-table th:nth-child(1),
.candidate-table td:nth-child(1) {
  width: 42px;
}

.candidate-table th:nth-child(2),
.candidate-table td:nth-child(2) {
  width: 180px;
}

.candidate-table th:nth-child(3),
.candidate-table td:nth-child(3) {
  width: 158px;
}

.candidate-table th:nth-child(4),
.candidate-table td:nth-child(4) {
  width: 92px;
}

.candidate-table th:nth-child(5),
.candidate-table td:nth-child(5) {
  width: 136px;
}

.candidate-table th:nth-child(6),
.candidate-table td:nth-child(6) {
  width: 76px;
}

.candidate-table th:nth-child(7),
.candidate-table td:nth-child(7) {
  width: 88px;
}

.candidate-table th:nth-child(8),
.candidate-table td:nth-child(8) {
  width: 78px;
}

.candidate-table th:nth-child(9),
.candidate-table td:nth-child(9) {
  width: 128px;
}

.candidate-table th:nth-child(10),
.candidate-table td:nth-child(10) {
  width: 360px;
}

.candidate-table th:nth-child(11),
.candidate-table td:nth-child(11) {
  width: 286px;
}

.candidate-table th:nth-child(12),
.candidate-table td:nth-child(12) {
  width: 94px;
}

.ticker {
  display: block;
  font-weight: 800;
}

.name,
.sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.sparkline {
  --spark: var(--green);
  --spark-fill: rgba(15, 138, 95, 0.1);
  width: 140px;
  min-height: 54px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 248, 251, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 13px, rgba(215, 223, 235, 0.45) 14px);
  display: grid;
  grid-template-rows: 36px 14px;
  gap: 1px;
  padding: 4px 7px 3px;
}

.sparkline.down {
  --spark: var(--red);
  --spark-fill: rgba(180, 35, 24, 0.09);
}

.sparkline.flat {
  --spark: var(--amber);
  --spark-fill: rgba(138, 90, 0, 0.1);
}

.sparkline svg {
  width: 100%;
  height: 36px;
  display: block;
  overflow: visible;
}

.spark-area {
  fill: var(--spark-fill);
  stroke: none;
}

.spark-line {
  fill: none;
  stroke: var(--spark);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.sparkline span {
  color: var(--spark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.sparkline-empty {
  width: 140px;
  min-height: 42px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.rs-badge,
.group-rank,
.rs-empty,
.group-empty {
  min-height: 54px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fbfcff;
  color: var(--muted);
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 6px 7px;
}

.rs-badge b,
.group-rank b {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.1;
}

.rs-badge span,
.rs-badge em,
.group-rank span {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.15;
}

.rs-badge.strong,
.rs-badge.positive {
  background: var(--green-bg);
  border-color: #b8e4d1;
}

.rs-badge.strong b,
.rs-badge.positive b {
  color: var(--green);
}

.rs-badge.neutral {
  background: var(--amber-bg);
  border-color: #f2dda1;
}

.rs-badge.neutral b {
  color: var(--amber);
}

.rs-badge.negative {
  background: var(--red-bg);
  border-color: #f2b7b2;
}

.rs-badge.negative b {
  color: var(--red);
}

.group-rank b {
  max-height: 29px;
  overflow: hidden;
}

.rs-empty,
.group-empty {
  min-height: 42px;
  border-style: dashed;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.score-strong {
  color: var(--green);
  font-weight: 800;
}

.score-positive {
  color: var(--green);
  font-weight: 700;
}

.score-neutral {
  color: var(--amber);
  font-weight: 700;
}

.score-negative {
  color: var(--red);
  font-weight: 700;
}

.state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 7px;
  white-space: nowrap;
}

.state.breakout {
  background: var(--green-bg);
  color: var(--green);
}

.state.near,
.state.coil,
.state.trend {
  background: var(--blue-bg);
  color: var(--blue);
}

.state.mixed {
  background: var(--amber-bg);
  color: var(--amber);
}

.state.risk {
  background: var(--red-bg);
  color: var(--red);
}

.state.watch {
  background: #f0f2f5;
  color: var(--muted);
}

.action-summary {
  min-width: 0;
}

.action-lines {
  display: grid;
  gap: 4px;
  margin-bottom: 7px;
}

.action-lines span {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: #fbfcff;
  color: var(--ink);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 6px;
  font-size: 12px;
  line-height: 1.25;
  padding: 5px 7px;
}

.action-lines b {
  color: var(--muted);
  font-size: 11px;
}

.framework-synthesis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.framework-pill {
  min-width: 0;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: var(--muted);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
}

.framework-pill b,
.framework-pill strong {
  font-size: 10px;
  line-height: 1;
}

.framework-pill em {
  min-width: 0;
  font-size: 11px;
  font-style: normal;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.framework-pill strong {
  text-align: right;
}

.framework-pill.strong,
.framework-pill.positive {
  background: var(--green-bg);
  border-color: #b8e4d1;
  color: var(--green);
}

.framework-pill.neutral {
  background: var(--amber-bg);
  border-color: #f2dda1;
  color: var(--amber);
}

.framework-pill.negative {
  background: var(--red-bg);
  border-color: #f2b7b2;
  color: var(--red);
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.heat-cell {
  min-width: 0;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f9fc;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.heat-cell b {
  font-size: 9px;
  line-height: 1;
}

.heat-cell em {
  font-size: 9px;
  font-style: normal;
  line-height: 1.15;
}

.heat-cell.strong,
.heat-cell.positive {
  background: var(--green-bg);
  border-color: #b8e4d1;
  color: var(--green);
}

.heat-cell.neutral {
  background: var(--amber-bg);
  border-color: #f2dda1;
  color: var(--amber);
}

.heat-cell.negative {
  background: var(--red-bg);
  border-color: #f2b7b2;
  color: var(--red);
}

details summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

details ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

details li {
  margin: 3px 0;
}

.framework-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0;
  margin-bottom: 32px;
}

.framework-card {
  min-width: 0;
  border-right: 1px solid var(--soft-line);
  padding: 12px;
}

.framework-card:last-child {
  border-right: 0;
}

.framework-card h3 {
  margin: 0 0 9px;
  font-size: 14px;
}

.framework-card ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.framework-card li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--soft-line);
  padding: 7px 0;
}

.framework-card span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.framework-library-section {
  padding-bottom: 36px;
}

.framework-library-head {
  align-items: center;
}

.library-search {
  flex-basis: 300px;
}

.library-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: -4px 0 11px;
}

.framework-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 10px;
}

.library-card,
.library-empty {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.library-card {
  min-height: 182px;
  padding: 13px 13px 12px;
}

.library-card-top,
.library-card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
}

.library-card-top {
  justify-content: space-between;
  margin-bottom: 9px;
}

.library-card-top span {
  width: 28px;
  min-width: 28px;
  min-height: 24px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
}

.library-card-top b {
  min-width: 0;
  border: 1px solid #c9d8ff;
  border-radius: 6px;
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  padding: 4px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.library-card p {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  margin: 5px 0 0;
}

.library-card-meta {
  color: var(--muted);
  flex-wrap: wrap;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  margin: 10px 0 9px;
}

.library-card-meta span {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: #fbfcff;
  padding: 4px 6px;
}

.library-card small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.library-empty {
  color: var(--muted);
  font-weight: 800;
  grid-column: 1 / -1;
  padding: 22px;
  text-align: center;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .framework-card {
    border-bottom: 1px solid var(--soft-line);
  }
}

@media (max-width: 820px) {
  .breakout-header,
  .control-strip,
	  .analysis-strip,
	  .group-rank-strip,
	  .summary-grid,
	  .workbench-section,
	  .framework-section,
	  .framework-library-section {
	    padding-left: 16px;
	    padding-right: 16px;
	  }

  .title-row,
  .section-head,
  .control-strip {
    display: block;
  }

  .freshness {
    text-align: left;
    margin-top: 12px;
  }

	  .search-box,
	  .library-search {
	    margin-top: 12px;
	    min-width: 0;
	  }

  .analysis-strip,
  .group-strip-head,
  .sort-box {
    align-items: stretch;
  }

  .sort-box,
  .export-button {
    width: 100%;
  }

  .sort-box select {
    flex: 1;
  }

  .group-chip {
    flex: 1 1 170px;
  }

  .market-cap-box {
    margin-top: 10px;
    grid-template-columns: auto minmax(74px, 1fr) minmax(118px, 1.1fr);
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .candidate-table {
    min-width: 1760px;
  }

  .framework-grid {
    grid-template-columns: 1fr;
  }

  .framework-card {
    border-right: 0;
  }
}
