.skill-jump-chip {
  appearance: none;
  font-family: Menlo, Consolas, "Courier New", Courier;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--attention);
  background-color: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 8px;
  min-height: 26px;
  cursor: pointer;
}

.skill-jump-chip:hover {
  border-color: var(--attention);
  background-color: var(--surface-elevated);
}

.tier-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.tier-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.role-card-btn {
  width: 100%;
  appearance: none;
  font-family: inherit;
  text-align: left;
  background-color: var(--surface-subtle);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-card-btn:hover {
  border-color: var(--line-strong);
  background-color: var(--surface-selected);
}

.role-card-btn[aria-pressed="true"] {
  background-color: var(--surface-elevated);
  border-color: var(--attention);
  box-shadow: var(--tab-shadow);
}

.role-card-btn.is-target {
  border-color: var(--live);
}

.role-card-btn.is-caller {
  border-color: var(--line-strong);
}

.role-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 8px;
}

.role-card-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.role-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.role-card-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 6px;
  background-color: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.role-card-btn[aria-pressed="true"] .role-card-tag {
  color: var(--attention);
  border-color: var(--attention);
}

.role-card-btn.is-target .role-card-tag {
  color: var(--live);
  border-color: var(--live);
}

.role-card-sub {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
}

.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cap-cell {
  padding: 8px 10px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.cap-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.cap-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
}

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

.split-2 > * {
  min-width: 0;
}

.split-col {
  padding: 16px 18px;
  min-width: 0;
}

.split-col + .split-col {
  border-left: 1px solid var(--line);
}

.tier-ladder,
.evidence-grid,
.hook-flow,
.rent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tier-step,
.ev-box,
.hook-item,
.rent-row {
  background-color: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.tier-step.is-t2 {
  border-left: 2px solid var(--attention);
  background-color: var(--surface-elevated);
}

.ev-box.is-allowed {
  border-left: 2px solid var(--live);
}

.tier-step-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.tier-code {
  font-family: Menlo, Consolas, "Courier New", Courier;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
}

.tier-step.is-t2 .tier-code {
  color: var(--attention);
}

.tier-desc,
.ev-box p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
}

.sim-pane {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sim-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sim-group-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.sim-result {
  background-color: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
}

.sim-outcome-badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: var(--surface-elevated);
  border: 1px solid var(--attention);
  color: var(--attention);
}

.sim-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-soft);
  min-width: 0;
}

.table-region {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--bg);
  margin-top: 8px;
}

table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.5;
}

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

thead th {
  background-color: var(--surface-subtle);
  font-weight: 600;
  color: var(--fg);
  border-bottom: 1px solid var(--line-strong);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: none;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.inv-cell {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.inv-cell:nth-child(even) {
  border-left: 1px solid var(--line);
}

.inv-cell:nth-last-child(-n+2) {
  border-bottom: none;
}

.inv-cell h3 {
  margin: 0;
}

.inv-rows {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
}

.inv-rows p {
  margin: 0;
}

.master-detail + .split-2 {
  border-top: 1px solid var(--line);
}

.fault-strip {
  padding: 12px 18px;
  background-color: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  border-left: 2px solid var(--attention);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--fg);
}

.hook-item {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-soft);
}

.hook-item strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
  color: var(--fg);
}

.rent-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rent-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}

.rent-head strong {
  font-weight: 600;
  color: var(--fg);
}

.rent-track {
  height: 5px;
  width: 100%;
  background-color: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.rent-fill {
  height: 100%;
  background-color: var(--attention);
  border-radius: 2px;
}

.rent-rule {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.catalog-body {
  padding: 16px 18px;
}

.dist-bar {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-bottom: 12px;
}

.dist-seg {
  appearance: none;
  font-family: inherit;
  border: 1px solid var(--line);
  background-color: var(--surface-subtle);
  color: var(--fg);
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 40px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  min-width: 0;
}

.dist-seg:hover {
  border-color: var(--line-strong);
  background-color: var(--surface-selected);
}

.dist-seg[aria-pressed="true"] {
  background-color: var(--surface-elevated);
  border-color: var(--attention);
  color: var(--attention);
}

.dist-seg strong {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dist-seg span {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dist-seg[aria-pressed="true"] span {
  color: var(--attention);
}

.catalog-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
}

.search-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.search-line label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
}

.search-input {
  flex: 1 1 16rem;
  min-width: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  background-color: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-height: 36px;
}

.search-input::placeholder {
  color: var(--muted);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill-btn {
  appearance: none;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background-color: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 10px;
  min-height: 28px;
  cursor: pointer;
}

.pill-btn:hover {
  border-color: var(--line-strong);
  color: var(--fg);
}

.pill-btn[aria-pressed="true"] {
  background-color: var(--surface-elevated);
  border-color: var(--attention);
  color: var(--attention);
  font-weight: 600;
}

.catalog-status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
}

.catalog-status-row p {
  margin: 0;
}

.skill-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.skill-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface-subtle);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.skill-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.skill-id {
  font-family: Menlo, Consolas, "Courier New", Courier;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.skill-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.scope-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background-color: var(--bg);
  color: var(--muted);
}

.skill-desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.catalog-more-row {
  margin-top: 12px;
}

.footnote {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 0 2px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.footnote-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

@media (max-width: 64rem) {
  .master-detail,
  .split-2,
  .inv-grid,
  .sim-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .readout-pane,
  .split-col + .split-col,
  .inv-cell:nth-child(even) {
    border-left: none;
    border-top: 1px solid var(--line);
  }

  .inv-cell:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .inv-cell:last-child {
    border-bottom: none;
  }

  .readout-pane {
    position: static;
  }

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

  .dist-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 48rem) {
  .page-shell {
    padding: 12px 12px 28px;
  }

  .stage-window {
    border-radius: 14px;
  }

  .pane-head,
  .scenario-bar,
  .dag-canvas,
  .tier-tree,
  .readout-pane,
  .split-col,
  .sim-pane,
  .inv-cell,
  .fault-strip,
  .catalog-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .lane-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .pipe-h {
    width: 1px;
    height: 10px;
    margin-left: 16px;
  }

  .fork-tracks,
  .loop-strip,
  .cap-grid,
  .tier-grid-2,
  .tier-grid-3,
  .skill-grid,
  .sim-result {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media print {
  body {
    background-color: #ffffff;
    color: #101113;
  }

  .preview-tools,
  .footnote-keys,
  .catalog-more-row {
    display: none !important;
  }

  .stage-window {
    box-shadow: none;
    border-color: #c4c9d0;
  }

  .view-panel[hidden] {
    display: block !important;
  }
}
