/*
  Ranking Detail UI Rules
  - Typography must use the token scale below. Avoid ad-hoc font sizes for page title, section title,
    body, caption, or card support text.
  - Primary vs secondary controls are distinguished by fill color and border, not shadow.
  - Overall summary card uses surface-tone emphasis; category cards use border emphasis for selection.
  - Dense table cells must preserve fixed width across display toggles whenever possible.
*/

:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #d9e2ec;
  --text: #23314d;
  --muted: #72809a;
  --brand: #0086d5;
  --brand-strong: #006faf;
  --brand-soft: #eef6ff;
  --accent: #f59e0b;
  --accent-soft: #fff5e8;
  --good: #21a16a;
  --warn: #e05b5f;
  --font-ui: "PingFang SC", "Avenir Next", "Microsoft YaHei", sans-serif;
  --type-page-title: 22px;
  --type-section-title: 20px;
  --type-section-title-small: 16px;
  --type-body-strong: 14px;
  --type-body: 13px;
  --type-body-small: 12px;
  --type-caption: 11px;
  --type-caption-strong: 12px;
  --line-page-title: 1.08;
  --line-section-title: 1.2;
  --line-body: 1.4;
  --line-caption: 1.35;
  --radius-card: 14px;
  --radius-control: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.page-shell {
  --metric-col-width: 140px;
  --trend-wrap-width: 0px;
  padding: 24px;
}

.page-shell--show-trend {
  --metric-col-width: 272px;
  --trend-wrap-width: 64px;
}

.page-title {
  font-size: var(--type-page-title);
  line-height: var(--line-page-title);
  font-weight: 700;
}

.section-title {
  font-size: var(--type-section-title);
  line-height: var(--line-section-title);
  font-weight: 700;
  margin-top: 4px;
}

.section-title--small {
  font-size: var(--type-section-title-small);
}

.section-kicker {
  color: var(--muted);
  font-size: var(--type-body-small);
  line-height: var(--line-caption);
}

.type-body-strong {
  font-size: var(--type-body-strong);
  line-height: var(--line-body);
}

.type-body {
  font-size: var(--type-body);
  line-height: var(--line-body);
}

.type-body-small {
  font-size: var(--type-body-small);
  line-height: var(--line-caption);
}

.type-caption {
  font-size: var(--type-caption);
  line-height: var(--line-caption);
}

.type-caption-strong {
  font-size: var(--type-caption-strong);
  line-height: var(--line-caption);
}

.detail-topbar,
.panel,
.config-modal {
  border: 1px solid var(--line);
  background: var(--panel);
}

.detail-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 16px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid #b8d1ec;
  border-radius: 12px;
  background: #eef6ff;
  color: #155ea6;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  border-color: #99c2eb;
  background: #e3f0ff;
}

.btn-secondary {
  background: #eef6ff;
  color: #155ea6;
}

.btn-secondary--compact {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 10px;
}

.btn-primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.detail-layout {
  margin-top: 16px;
  display: grid;
  gap: 0;
}

.panel,
.config-modal {
  border-radius: 16px;
  padding: 18px;
}

.summary-pill,
.meta-chip,
.permission-badge,
.toggle-chip,
.summary-card,
.analysis-card__tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.summary-pill,
.meta-chip,
.summary-card {
  color: var(--muted);
  background: #f6f8fb;
}

.summary-pill--main,
.summary-pill--rank,
.meta-chip--main {
  color: var(--brand);
  background: var(--brand-soft);
}

.workbench-panel {
  display: grid;
  gap: 14px;
}

.workbench-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-section--right {
  justify-content: flex-end;
  justify-self: end;
}

.pill-tabs,
.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6f8fb;
}

.pill-tab,
.mode-switch__item {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.pill-tab.active,
.mode-switch__item.active {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  border: 1px solid #cfe0f2;
}

.mode-switch__item:disabled {
  cursor: not-allowed;
  color: #b3bfd0;
}

.mode-switch__item.is-disabled {
  color: #b3bfd0;
}

.input {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #d8e0ea;
  border-radius: 10px;
  background: #fff;
}

.input--small {
  width: 94px;
}

.input--metric-search {
  width: 180px;
}

.assign-toolbar-panel {
  display: none;
  margin-top: -2px;
}

.assign-toolbar-panel--visible {
  display: block;
}

.assign-toolbar {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(33, 161, 106, 0.16);
  border-radius: 14px;
  background: #f6fcf8;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.assign-toolbar--active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.assign-toolbar__left {
  padding-left: 0;
}

.assign-toolbar__right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.assign-toolbar__group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid rgba(33, 161, 106, 0.18);
}

.assign-toolbar__group:first-child {
  padding-left: 0;
  border-left: 0;
}

.assign-toolbar__group--muted,
.assign-toolbar__group--actions {
  padding-left: 14px;
}

.table-panel {
  display: grid;
  gap: 10px;
}

.level-summary-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  min-height: 172px;
}

.level-summary-box__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.level-summary-box__title-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.level-summary-box__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.permission-badge {
  color: #b76d00;
  background: var(--accent-soft);
}

.permission-badge--editable {
  color: var(--good);
  background: rgba(33, 161, 106, 0.12);
}

.level-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.summary-card {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 12px 10px 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.summary-card--category {
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.summary-card--category:hover {
  border-color: #b8d1ec;
}

.summary-card--selected {
  border-color: #7fb7e8;
  background: #ffffff;
}

.summary-card--selected .summary-card__title {
  color: var(--brand);
}

.summary-card--selected .summary-card__stat {
  color: var(--text);
}

.summary-card--selected .summary-card__meta {
  color: var(--muted);
}

.summary-card--selected .summary-card__strip {
  background: #fff5e8;
  color: #b76d00;
}

.summary-card--overall {
  background: linear-gradient(180deg, #f3f8fe 0%, #eef5fd 100%);
  border-color: transparent;
  box-shadow: none;
  grid-template-rows: auto 1fr;
}

.summary-card--overall .summary-card__title {
  color: var(--text);
  font-size: 15px;
}

.summary-card__overview-list {
  display: grid;
  gap: 6px;
}

.summary-card__overview-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #f7f9fc;
}

.summary-card__overview-item--primary {
  background: #ffffff;
  border-left: 4px solid #0086d5;
  height: 40px;
}

.summary-card--overall .summary-card__overview-item:not(.summary-card__overview-item--primary) {
  background: rgba(255, 255, 255, 0.72);
}

.summary-card__overview-item--split {
  align-items: center;
}

.summary-card__overview-label {
  color: var(--muted);
  font-size: var(--type-caption);
  line-height: var(--line-caption);
}

.summary-card__overview-value {
  color: var(--text);
  font-size: var(--type-body-small);
  font-weight: 600;
  line-height: 1.15;
  text-align: left;
}

.summary-card__overview-value--metric {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  font-size: var(--type-body-strong);
  font-weight: 700;
}

.summary-card__overview-split {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.summary-card__overview-block {
  display: grid;
  gap: 0;
  min-width: 0;
  align-content: center;
  flex: 0 1 auto;
}

.summary-card__overview-gap-list {
  display: grid;
  gap: 2px;
  align-content: center;
}

.summary-card__overview-subtitle {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.summary-card__overview-line {
  display: block;
}

.summary-card__overview-item--split .summary-card__overview-value {
  white-space: nowrap;
}

.summary-card__overview-value--pair {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.summary-card__overview-divider {
  color: var(--text);
}

.summary-card__overview-value--singleline {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-card__overview-block--full {
  flex: 1 1 auto;
}

.summary-card__title {
  display: flex;
  align-items: flex-start;
  min-height: 24px;
  font-size: var(--type-body-strong);
  font-weight: 700;
  line-height: 1.3;
}

.summary-card__stat {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.summary-card__strip {
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff5e8;
  color: #b76d00;
  font-size: var(--type-caption-strong);
  font-weight: 600;
  line-height: 1.3;
  display: inline-flex;
  align-items: center;
}

.summary-path {
  color: var(--muted);
  font-size: var(--type-body-small);
  line-height: var(--line-body);
}

.summary-card__meta {
  color: var(--muted);
  font-size: var(--type-caption-strong);
  font-weight: 500;
  line-height: var(--line-body);
}

.summary-card strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.table-panel__context {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding-top: 2px;
}

.table-panel__context-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.sticky-head-main {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.sticky-head-main__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.scope-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid #cfe0f2;
  border-radius: 999px;
  background: #eef6ff;
}

.scope-switch button {
  min-height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #4f6b8c;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.scope-switch button.active {
  background: #fff;
  color: var(--brand);
}

.head-search-input {
  width: 100%;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #d8e0ea;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.table-head-scope-toggle {
  justify-self: center;
  font-size: 12px;
  color: var(--brand);
}

.table-panel__subhead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-width: 0;
  min-height: 42px;
  padding: 2px 0;
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.detail-heading--summary {
  align-items: center;
}

.detail-heading .section-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.table-panel__left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.table-back-link {
  border: 0;
  background: transparent;
  color: #4f6b8c;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.table-back-link:hover {
  color: #155ea6;
}

.table-panel__controls {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toggle-chip {
  gap: 6px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #d9e2ec;
  cursor: pointer;
}

.toggle-chip input:disabled+span {
  color: #b1bccd;
}

.toggle-chip.is-disabled {
  background: #f4f6f8;
  border-color: #e2e8f0;
  cursor: not-allowed;
}

.toggle-chip input {
  margin: 0;
}

.category-tabs {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.category-tabs--table {
  padding-top: 2px;
}

.category-tab {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.category-tab.active {
  color: var(--brand);
  border-color: #b8d1ec;
  background: #eef6ff;
}

.table-wrapper {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  scrollbar-width: thin;
}

.detail-table {
  width: 100%;
  min-width: calc(180px + 24 * var(--metric-col-width));
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.detail-table th,
.detail-table td {
  padding: 12px 14px;
  border-right: 1px solid #eef2f7;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  white-space: nowrap;
}

.detail-table th {
  background: #fafbfd;
  color: #607189;
  font-size: 13px;
  cursor: pointer;
  position: sticky;
  top: 0;
  z-index: 1;
  vertical-align: top;
}

.detail-table th[data-main="true"] {
  color: var(--brand);
  background: #f2f8fe;
}

.metric-head--main {
  box-shadow: inset 0 -2px 0 var(--brand);
}

.detail-table th:not([data-metric-key]) {
  cursor: default;
}

.detail-table th[data-metric-key] {
  display: table-cell;
  width: var(--metric-col-width);
  min-width: var(--metric-col-width);
  max-width: var(--metric-col-width);
}

.head-group-row th {
  top: 0;
  z-index: 3;
  text-align: center;
  font-weight: 700;
  background: #f6f9fc;
  height: 44px;
  padding-top: 10px;
  padding-bottom: 10px;
  vertical-align: middle;
}

.head-metric-row th {
  top: 44px;
  z-index: 2;
  height: 82px;
  min-height: 82px;
  padding-top: 12px;
  padding-bottom: 12px;
  background: #fbfcfe;
}

.sticky-col--name-head {
  top: 0;
  z-index: 5 !important;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  vertical-align: middle !important;
}

.category-head {
  color: #44556f;
}

.category-head--active {
  color: var(--brand);
  background: rgba(0, 134, 213, 0.05) !important;
}

.metric-head__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-height: 36px;
}

.metric-head__label {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.metric-head__meta {
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  flex: 0 0 auto;
  padding-top: 1px;
}

.metric-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 1px solid #b9c6d8;
  border-radius: 999px;
  color: #7b899b;
  font-size: 10px;
  line-height: 1;
  background: #fff;
  cursor: help;
}

.metric-help::after {
  content: none;
}

.metric-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  max-width: 240px;
  min-width: 180px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(35, 49, 77, 0.96);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 12px 28px rgba(15, 25, 40, 0.2);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 200;
}

.metric-tooltip--visible {
  opacity: 1;
  transform: translateY(0);
}

.metric-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-top: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f4f6fa;
  color: #7a8799;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.metric-type-badge--assessed {
  background: rgba(0, 134, 213, 0.08);
  color: var(--brand);
}

.head-group-row .category-head {
  border-right: 2px solid #d7e1ee;
}

.head-group-row .category-head:last-child {
  border-right: 1px solid #eef2f7;
}

.head-metric-row th:nth-child(6n) {
  border-right: 2px solid #d7e1ee;
}

.head-metric-row th:last-child {
  border-right: 1px solid #eef2f7;
}

.sort-icon {
  display: inline-grid;
  margin-left: 0;
  color: #b4bfd0;
  font-size: 9px;
  line-height: 0.82;
  vertical-align: top;
  justify-items: center;
  flex: 0 0 auto;
  margin-top: 1px;
}

.sort-icon--active {
  color: var(--brand);
}

.sort-icon__up,
.sort-icon__down {
  display: block;
}

.sort-icon__part--active {
  color: var(--brand);
}

.sticky-col--name {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  box-shadow: 1px 0 0 #e6edf5;
}

.detail-table th.sticky-col--name {
  z-index: 4;
}

.detail-table td.sticky-col--name {
  z-index: 2;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.drill-btn {
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.table-row--self td {
  background: #f4f9ff;
}

.table-row--self .sticky-col--name {
  background: #eaf4ff;
}

.table-row--self .drill-btn {
  font-weight: 700;
}

.level-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 12px;
}

.metric-cell {
  width: var(--metric-col-width);
  min-width: var(--metric-col-width);
  max-width: var(--metric-col-width);
}

.detail-table tbody td:nth-child(7),
.detail-table tbody td:nth-child(13),
.detail-table tbody td:nth-child(19),
.detail-table tbody td:nth-child(25) {
  border-right: 2px solid #d7e1ee;
}

.detail-table tbody td:last-child {
  border-right: 1px solid #eef2f7;
}

.metric-cell--main {
  background: rgba(0, 134, 213, 0.035) !important;
}

.metric-stack {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 54px;
  align-content: start;
}

.metric-stack__value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.metric-stack__target {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.metric-stack__pair {
  display: grid;
  grid-template-columns: max-content auto max-content;
  align-items: center;
  justify-content: start;
  gap: 0;
  min-height: 30px;
  width: 100%;
  white-space: nowrap;
}

.metric-stack__divider {
  color: var(--muted);
  justify-self: center;
  margin: 0 1px 0 0;
}

.metric-stack__divider.is-hidden {
  visibility: hidden;
  width: 0;
  min-width: 0;
  overflow: hidden;
}

.metric-stack__target-slot {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 30px;
  justify-content: flex-start;
  white-space: nowrap;
}

.metric-stack__target-slot.is-hidden {
  visibility: hidden;
}

.metric-stack__subline {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 20px;
  width: 100%;
}

.metric-stack__input {
  width: 78px;
  min-width: 78px;
  height: 28px;
  border-radius: 10px;
}

.metric-rank-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f3f6fa;
  color: #61748d;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.metric-rank-badge--main {
  background: rgba(0, 134, 213, 0.1);
  color: var(--brand);
}

.trend-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
  flex: 0 0 var(--trend-wrap-width);
  width: var(--trend-wrap-width);
  min-width: var(--trend-wrap-width);
  padding: 2px 5px;
  border-radius: 999px;
  background: #f7f9fc;
  opacity: 0.78;
  justify-content: center;
  visibility: hidden;
  overflow: hidden;
}

.page-shell--show-trend .trend-wrap {
  visibility: visible;
}

.trend-line {
  width: 48px;
  height: 18px;
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-line--down {
  stroke: var(--warn);
}

.assign-disabled-tip {
  position: relative;
}

.assign-disabled-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(35, 49, 77, 0.92);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.assign-disabled-tip:hover::after {
  opacity: 1;
}

.tone-good {
  color: var(--good);
}

.tone-warn {
  color: var(--warn);
}

.tone-neutral {
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(18, 29, 52, 0.28);
  z-index: 50;
}

.overlay--open {
  display: block;
}

.guide-overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(16, 24, 40, 0.28);
  z-index: 90;
}

.guide-overlay--open {
  display: block;
}

.guide-target-active {
  position: relative;
  z-index: 91 !important;
  border-radius: 14px;
  box-shadow:
    0 0 0 3px rgba(0, 134, 213, 0.18),
    0 16px 36px rgba(18, 38, 63, 0.18);
}

.guide-popover {
  position: fixed;
  top: 120px;
  right: 24px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: none;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 48px rgba(24, 37, 57, 0.16);
  z-index: 92;
  overflow: auto;
}

.guide-popover--open {
  display: grid;
}

.guide-popover__head,
.guide-popover__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guide-popover__body {
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  display: grid;
  gap: 8px;
}

.guide-popover__body p {
  margin: 0;
}

.guide-popover__body ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.guide-popover__body li {
  margin: 0;
}

.guide-popover__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(980px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 32px));
  display: none;
  grid-template-rows: auto 1fr auto;
  transform: translate(-50%, -50%);
  z-index: 51;
  overflow: hidden;
}

.config-modal--open {
  display: grid;
}

.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100% - 32px));
  display: none;
  transform: translate(-50%, -50%);
  z-index: 52;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.confirm-modal--open {
  display: grid;
  gap: 14px;
}

.confirm-modal__body {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.confirm-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.config-modal__head,
.config-modal__footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.config-modal__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  max-height: min(640px, calc(100vh - 220px));
  min-height: 0;
  overflow: hidden;
}

.config-column {
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.config-column__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.config-modal__search-row {
  margin-top: 14px;
}

.input--full {
  width: 100%;
}

.config-grid,
.config-rank-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  overflow: auto;
  min-height: 0;
  padding-right: 6px;
  scrollbar-width: thin;
}

.config-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}

.config-group,
.config-rank-group {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.config-group:first-child,
.config-rank-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.config-group__title {
  color: var(--brand);
  font-weight: 600;
}

.config-group__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.config-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.config-rank-item {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 13px;
}

.config-rank-item__main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.config-subgroup {
  display: grid;
  gap: 8px;
}

.config-subgroup__title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.config-rank-item--main {
  background: rgba(0, 134, 213, 0.06);
}

.drag-handle,
.link-action,
.link-clear,
.close-icon {
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.link-action[disabled] {
  opacity: 0.36;
  cursor: not-allowed;
}

.main-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 159, 67, 0.14);
  color: #b76d00;
  font-size: 12px;
}



@media (max-width: 1280px) {

  .workbench-toolbar,
  .table-panel__context,
  .table-panel__subhead,
  .level-summary-box__head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .workbench-toolbar {
    display: flex;
  }

  .toolbar-section--center,
  .toolbar-section--right {
    justify-content: flex-start;
    justify-self: stretch;
  }

  .table-panel__controls {
    justify-content: flex-start;
  }

  .level-summary-cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 840px) {
  .page-shell {
    padding: 16px;
  }

  .detail-topbar,
  .assign-toolbar,
  .config-modal__head,
  .config-modal__footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .config-modal__body,
  .config-group__grid {
    grid-template-columns: 1fr;
  }

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

  .summary-card__overview-item {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 10px 12px;
  }

  .summary-card__overview-value {
    font-size: 20px;
  }

  .guide-popover {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
  }
}
