/* Reference styles. The :where() scope keeps project overrides straightforward. */
[data-ds] {
  color: var(--ds-text);
  font: var(--ds-font-body)/var(--ds-leading-body) var(--ds-font);
  font-variant-numeric: tabular-nums;
  font-synthesis: none;
}
:where([data-ds]) *, :where([data-ds]) *::before, :where([data-ds]) *::after { box-sizing: border-box; }
:where([data-ds]) :is(button, input, select, textarea) { font: inherit; color: inherit; }
:where([data-ds]) :is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ds-focus);
  outline-offset: 2px;
}
:where([data-ds]) .ds-icon { width: 16px; height: 16px; flex: none; stroke-width: var(--ds-icon-stroke); }
:where([data-ds]) .ds-meta { color: var(--ds-meta); font-size: var(--ds-font-meta); }
:where([data-ds]) .ds-mono { font-family: var(--ds-font-mono); }
:where([data-ds]) .ds-link { color: var(--ds-link); text-decoration: none; text-underline-offset: 3px; }
:where([data-ds]) .ds-link:hover { text-decoration: underline; }
:where([data-ds]) .ds-skip {
  position: fixed;
  z-index: var(--ds-z-feedback);
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  background: var(--ds-white);
  transform: translateY(-160%);
}
:where([data-ds]) .ds-skip:focus { transform: none; }

/* Controls */
:where([data-ds]) :is(.ds-button, .ds-icon-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--ds-control-height);
  padding: 6px 11px;
  border: 1px solid var(--ds-line-control);
  border-radius: var(--ds-radius-control);
  background: var(--ds-white);
  box-shadow: var(--ds-shadow-control);
  font-size: var(--ds-font-control);
  font-weight: var(--ds-weight-medium);
  line-height: var(--ds-leading-short);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--ds-motion-fast) var(--ds-ease);
}
:where([data-ds]) :is(.ds-button, .ds-icon-button):hover:not(:disabled) { background: var(--ds-hover); }
:where([data-ds]) :is(.ds-button, .ds-icon-button):active:not(:disabled) { background: var(--ds-selected); }
:where([data-ds]) :is(.ds-button, .ds-icon-button):disabled { opacity: .55; cursor: default; }
:where([data-ds]) .ds-button.ds-button--primary { background: var(--ds-action); color: var(--ds-white); border-color: var(--ds-action); }
:where([data-ds]) .ds-button.ds-button--primary:hover:not(:disabled) { background: var(--ds-action-hover); }
:where([data-ds]) .ds-button.ds-button--danger { background: var(--ds-danger); color: var(--ds-white); border-color: var(--ds-danger); }
:where([data-ds]) .ds-button.ds-button--danger:hover:not(:disabled) { background: var(--ds-danger-hover); }
:where([data-ds]) :is(.ds-button--quiet, .ds-icon-button) { background: transparent; border-color: transparent; box-shadow: none; }
:where([data-ds]) .ds-icon-button { width: var(--ds-control-height); flex: none; padding: 0; }
:where([data-ds]) .ds-button--compact { min-height: var(--ds-control-xs); padding: 4px 8px; font-size: var(--ds-font-meta); }
:where([data-ds]) .ds-icon-button[aria-pressed="true"] { background: var(--ds-selected); }
:where([data-ds]) .ds-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* Shell and navigation */
:where([data-ds]) .ds-shell {
  display: grid;
  grid-template-columns: var(--ds-sidebar-width) minmax(0, 1fr);
  min-height: 100dvh;
  background: var(--ds-white);
}
:where([data-ds]) .ds-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  padding-inline: 12px;
  background: var(--ds-sidebar);
  border-right: 1px solid var(--ds-line);
}
:where([data-ds]) .ds-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 70px;
  padding: 10px 6px;
  color: var(--ds-ink);
  text-decoration: none;
}
:where([data-ds]) .ds-brand small { display: block; }
:where([data-ds]) .ds-nav { flex: 1; min-height: 0; overflow: auto; padding: 0 3px 16px; scrollbar-width: thin; }
:where([data-ds]) .ds-nav-title { margin: 0; padding: 22px 8px 7px; color: var(--ds-muted); font-size: 12px; font-weight: 500; letter-spacing: .2px; }
:where([data-ds]) .ds-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: var(--ds-radius-nav);
  color: var(--ds-text);
  text-decoration: none;
}
:where([data-ds]) .ds-nav-item:hover { background: var(--ds-hover); }
:where([data-ds]) .ds-nav-item[aria-current="page"] { background: var(--ds-selected); color: var(--ds-ink); font-weight: 600; }
:where([data-ds]) .ds-nav-item > .ds-meta { margin-inline-start: auto; }
:where([data-ds]) .ds-sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 14px 8px; border-top: 1px solid var(--ds-line); }
:where([data-ds]) .ds-header {
  position: sticky;
  top: 0;
  z-index: var(--ds-z-header);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: var(--ds-header-height);
  padding: 0 var(--ds-page-gutter);
  border-bottom: 1px solid var(--ds-line);
  background: var(--ds-white);
}
:where([data-ds]) .ds-path { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: var(--ds-font-control); }
:where([data-ds]) .ds-path > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:where([data-ds]) :is(.ds-heading, .ds-detail-heading) {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: var(--ds-heading-height);
  padding: 14px var(--ds-page-gutter);
}
:where([data-ds]) .ds-heading-copy { display: flex; min-width: 0; align-items: center; gap: 12px; }
:where([data-ds]) :is(.ds-heading, .ds-detail-heading) h1 { margin: 0; font-size: var(--ds-font-list-title); color: var(--ds-ink); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
:where([data-ds]) :is(.ds-heading, .ds-detail-heading) p { margin: 4px 0 0; }
:where([data-ds]) .ds-viewbar {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: var(--ds-viewbar-height);
  padding-inline: var(--ds-page-gutter);
  border-block: 1px solid var(--ds-line);
}
:where([data-ds]) .ds-tabs { display: flex; min-width: 0; gap: 18px; overflow: auto; scrollbar-width: thin; }
:where([data-ds]) .ds-tabs button {
  flex: none;
  min-height: calc(var(--ds-viewbar-height) - 2px);
  padding: 2px 3px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ds-muted);
  font-size: var(--ds-font-meta);
  cursor: pointer;
}
:where([data-ds]) .ds-tabs button[aria-pressed="true"] { color: var(--ds-ink); border-bottom-color: var(--ds-ink); font-weight: 600; }
:where([data-ds]) .ds-tabs button:focus-visible { outline-offset: -2px; }
:where([data-ds]) .ds-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px var(--ds-page-gutter);
  border-bottom: 1px solid var(--ds-line);
}
:where([data-ds]) .ds-toolbar .ds-search { margin-inline-start: auto; }

/* Icons, labels and data views */
:where([data-ds]) [data-color="purple"] { --ds-object-color: var(--ds-object-purple); }
:where([data-ds]) [data-color="blue"] { --ds-object-color: var(--ds-object-blue); }
:where([data-ds]) [data-color="green"] { --ds-object-color: var(--ds-object-green); }
:where([data-ds]) [data-color="orange"] { --ds-object-color: var(--ds-object-orange); }
:where([data-ds]) [data-color="rose"] { --ds-object-color: var(--ds-object-rose); }
:where([data-ds]) [data-color="teal"] { --ds-object-color: var(--ds-object-teal); }
:where([data-ds]) .ds-object {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 26px;
  border-radius: var(--ds-radius-nav);
  background: var(--ds-object-color, var(--ds-object-default));
  color: var(--ds-white);
}
:where([data-ds]) .ds-object--small { width: 21px; height: 21px; }
:where([data-ds]) .ds-object--small .ds-icon { width: 13px; height: 13px; }
:where([data-ds]) .ds-object--large { width: 48px; height: 50px; border-radius: var(--ds-radius-dialog); }
:where([data-ds]) .ds-object--large .ds-icon { width: 26px; height: 26px; }
:where([data-ds]) .ds-avatar { display: inline-grid; place-items: center; flex: none; width: 21px; height: 21px; border-radius: 5px; background: var(--ds-info-bg); color: var(--ds-info-fg); font-size: 12px; }
:where([data-ds]) [data-tone="info"] { --ds-tone-fg: var(--ds-info-fg); --ds-tone-bg: var(--ds-info-bg); --ds-tone-line: var(--ds-info-line); }
:where([data-ds]) [data-tone="success"] { --ds-tone-fg: var(--ds-success-fg); --ds-tone-bg: var(--ds-success-bg); --ds-tone-line: var(--ds-success-line); }
:where([data-ds]) [data-tone="accent"] { --ds-tone-fg: var(--ds-accent-fg); --ds-tone-bg: var(--ds-accent-bg); --ds-tone-line: var(--ds-accent-line); }
:where([data-ds]) [data-tone="warning"] { --ds-tone-fg: var(--ds-warning-fg); --ds-tone-bg: var(--ds-warning-bg); --ds-tone-line: var(--ds-warning-line); }
:where([data-ds]) [data-tone="error"] { --ds-tone-fg: var(--ds-error-fg); --ds-tone-bg: var(--ds-error-bg); --ds-tone-line: var(--ds-error-line); }
:where([data-ds]) .ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid var(--ds-tone-line, var(--ds-neutral-line));
  border-radius: var(--ds-radius-label);
  background: var(--ds-tone-bg, var(--ds-neutral-bg));
  color: var(--ds-tone-fg, var(--ds-neutral-fg));
  font-size: var(--ds-font-meta);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
:where([data-ds]) .ds-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
:where([data-ds]) .ds-table-scroll { min-width: 0; overflow: auto; scrollbar-width: thin; }
/* 固定高度滚动容器：配合表头吸顶，避免长列表把页面无限拉长 */
:where([data-ds]) .ds-table-scroll.ds-table-scroll--fixed { max-height: 480px; }
:where([data-ds]) .ds-table { width: 100%; min-width: var(--ds-table-min); border-collapse: collapse; table-layout: fixed; font-size: 13.5px; }
:where([data-ds]) .ds-table th, :where([data-ds]) .ds-table td { padding: 0 11px; border-bottom: 1px solid var(--ds-line); border-right: 1px solid var(--ds-line-subtle); text-align: start; }
:where([data-ds]) .ds-table th { height: 36px; background: var(--ds-surface-soft); color: var(--ds-muted); font-size: var(--ds-font-meta); font-weight: var(--ds-weight-strong); }
:where([data-ds]) .ds-table td { height: var(--ds-row-height); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 滚动容器内的表头吸顶 */
:where([data-ds]) .ds-table-scroll .ds-table thead th { position: sticky; top: 0; z-index: 1; }
/* 允许换行的长文本列：完整展示内容，行高随内容自适应 */
:where([data-ds]) .ds-table td.ds-col-wrap { height: auto; min-height: var(--ds-row-height); white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: var(--ds-leading-body); }
:where([data-ds]) .ds-table :is(th, td):last-child { border-right: 0; }
:where([data-ds]) .ds-table tbody tr:hover { background: var(--ds-surface-soft); }
:where([data-ds]) .ds-table tr[data-selected="true"] { background: var(--ds-row-selected); }
:where([data-ds]) .ds-table .ds-number { text-align: end; }
:where([data-ds]) .ds-record { display: flex; align-items: center; gap: 9px; min-width: 0; }
:where([data-ds]) .ds-record-copy { min-width: 0; }
:where([data-ds]) .ds-record-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-ink); font-size: var(--ds-font-control); font-weight: 500; text-decoration: none; }
:where([data-ds]) .ds-record-link:hover { text-decoration: underline; text-underline-offset: 3px; }
:where([data-ds]) .ds-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px var(--ds-page-gutter); border-top: 1px solid var(--ds-line); }
:where([data-ds]) .ds-board { display: flex; overflow: auto; gap: 16px; padding: 20px var(--ds-page-gutter); scrollbar-width: thin; }
:where([data-ds]) .ds-board-column { flex: 0 0 265px; min-width: 0; }
:where([data-ds]) .ds-board-column h2 { display: flex; align-items: center; gap: 8px; font-size: var(--ds-font-control); margin: 0 0 10px; }
:where([data-ds]) .ds-card { margin: 0 0 10px; padding: 14px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-card); background: var(--ds-white); }
:where([data-ds]) .ds-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
:where([data-ds]) .ds-metric { padding: 0 var(--ds-space-4); min-width: 0; border-inline-start: 1px solid var(--ds-line); }
:where([data-ds]) .ds-metric:first-child { padding-inline-start: 0; border-inline-start: 0; }
:where([data-ds]) .ds-metric strong { display: block; margin-block: 7px 3px; color: var(--ds-ink); font-size: 30px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }

/* Details and forms */
:where([data-ds]) .ds-detail-heading { align-items: flex-start; padding: 26px 0; }
:where([data-ds]) .ds-detail-heading h1 { font-size: var(--ds-font-title); }
:where([data-ds]) .ds-detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--ds-detail-side); border-top: 1px solid var(--ds-line); }
:where([data-ds]) .ds-detail-main { min-width: 0; padding: 26px 28px 0 0; }
:where([data-ds]) .ds-detail-aside { min-width: 0; padding: 26px 0 0 24px; border-inline-start: 1px solid var(--ds-line); }
:where([data-ds]) .ds-section { min-width: 0; padding-block: 24px; border-top: 1px solid var(--ds-line); }
:where([data-ds]) .ds-section h2 { margin: 0 0 14px; color: var(--ds-ink); font-size: var(--ds-font-section); font-weight: 600; }
:where([data-ds]) .ds-facts { display: grid; gap: 13px; margin: 0; font-size: var(--ds-font-control); }
:where([data-ds]) .ds-facts > div { display: grid; grid-template-columns: minmax(72px, 95px) minmax(0, 1fr); gap: 10px; }
:where([data-ds]) .ds-facts dt { color: var(--ds-meta); }
:where([data-ds]) .ds-facts dd { margin: 0; overflow-wrap: anywhere; }
:where([data-ds]) .ds-timeline { list-style: none; padding: 0; margin: 0; }
:where([data-ds]) .ds-timeline > li { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; min-height: 54px; padding-bottom: 18px; }
:where([data-ds]) .ds-timeline > li:not(:last-child)::before { content: ''; position: absolute; inset: 26px auto 0 12px; width: 1px; background: var(--ds-line); }
:where([data-ds]) .ds-timeline-mark { display: grid; place-items: center; height: 26px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-control); background: var(--ds-surface-soft); color: var(--ds-muted); }
:where([data-ds]) .ds-timeline-mark .ds-icon { width: 14px; height: 14px; }
:where([data-ds]) .ds-field { display: grid; align-content: start; min-width: 0; gap: 6px; color: var(--ds-muted); font-size: var(--ds-font-control); }
:where([data-ds]) .ds-field > small { font-size: var(--ds-font-meta); color: var(--ds-meta); }
:where([data-ds]) .ds-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--ds-field-height);
  padding: 8px 10px;
  border: 1px solid var(--ds-line-control);
  border-radius: var(--ds-radius-control);
  background: var(--ds-white);
  color: var(--ds-text);
  font-size: var(--ds-font-control);
}
:where([data-ds]) textarea.ds-input { min-height: 90px; resize: vertical; }
:where([data-ds]) .ds-input[readonly] { background: var(--ds-surface-soft); }
:where([data-ds]) .ds-input[aria-invalid="true"] { border-color: var(--ds-danger); }
:where([data-ds]) .ds-input:disabled { background: var(--ds-hover); opacity: .65; }
:where([data-ds]) .ds-field .ds-field-error { color: var(--ds-error-fg); }
:where([data-ds]) .ds-search { display: flex; align-items: center; gap: 7px; min-width: 0; width: 160px; padding: 0 9px; border: 1px solid var(--ds-line-control); border-radius: 5px; background: var(--ds-white); }
:where([data-ds]) .ds-search input { min-width: 0; width: 100%; height: 31px; padding: 0; border: 0; background: transparent; font-size: var(--ds-font-control); outline: none; }
:where([data-ds]) .ds-search:focus-within { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
:where([data-ds]) .ds-filter { min-height: 31px; width: auto; max-width: 100%; padding-block: 3px; font-size: var(--ds-font-meta); }
:where([data-ds]) .ds-form-layout { display: grid; grid-template-columns: minmax(0, var(--ds-form-main)) var(--ds-form-side); gap: var(--ds-form-gap); max-width: 1100px; }
:where([data-ds]) .ds-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
:where([data-ds]) .ds-form-wide { grid-column: 1 / -1; }
:where([data-ds]) .ds-options { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; padding: 0; border: 0; }
:where([data-ds]) .ds-options legend { padding: 0; margin-bottom: 8px; }
:where([data-ds]) .ds-options label { display: flex; align-items: center; gap: 7px; min-height: var(--ds-field-height); padding: 6px 10px; border: 1px solid var(--ds-line-control); border-radius: var(--ds-radius-control); cursor: pointer; }
:where([data-ds]) .ds-options label:has(:checked) { background: var(--ds-info-bg); border-color: var(--ds-focus); }
:where([data-ds]) .ds-actionbar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-height: var(--ds-actionbar-height); padding: 10px var(--ds-page-gutter) max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--ds-line); background: var(--ds-white); }

/* Dialogs and feedback */
:where([data-ds]) .ds-dialog {
  width: var(--ds-dialog-width);
  max-width: calc(100% - 32px);
  max-height: 88dvh;
  padding: 0;
  overflow: auto;
  color: var(--ds-text);
  background: var(--ds-white);
  border: 1px solid var(--ds-line-control);
  border-radius: var(--ds-radius-dialog);
  box-shadow: var(--ds-shadow-dialog);
}
:where([data-ds]) .ds-dialog::backdrop { background: var(--ds-backdrop); }
:where([data-ds]) .ds-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--ds-line); }
:where([data-ds]) .ds-dialog-header h2 { margin: 0; color: var(--ds-ink); font-size: var(--ds-font-section); }
:where([data-ds]) .ds-dialog-body { padding: 20px; }
:where([data-ds]) .ds-dialog.ds-drawer { inset: 0 0 0 auto; width: min(360px, 94vw); max-width: none; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
:where([data-ds]) .ds-notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border: 1px solid var(--ds-tone-line, var(--ds-info-line)); border-radius: var(--ds-radius-card); background: var(--ds-tone-bg, var(--ds-info-bg)); color: var(--ds-tone-fg, var(--ds-info-fg)); font-size: var(--ds-font-control); overflow-wrap: anywhere; }
:where([data-ds]) .ds-notice p { margin: 3px 0 0; }
:where([data-ds]) .ds-empty { padding: 60px var(--ds-page-gutter); text-align: center; color: var(--ds-muted); }
:where([data-ds]) .ds-empty h2 { margin: 4px 0; font-size: var(--ds-font-section); color: var(--ds-ink); }
:where([data-ds]) .ds-empty p { margin: 2px 0 12px; }
:where([data-ds]) .ds-toast { position: fixed; top: 15px; left: 50%; z-index: var(--ds-z-feedback); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; color: var(--ds-success-fg); border: 1px solid var(--ds-success-line); border-radius: var(--ds-radius-card); background: var(--ds-white); box-shadow: var(--ds-shadow-menu); }

/* ===== 行级语义着色：整行表达数值档位，比单格底色更易扫读 ===== */
/* 用法：<tr data-tier="2">…，关键数值单元格加 .ds-tier-accent 强调前景 */
:where([data-ds]) .ds-table tbody tr[data-tier="1"] { background: #f0f2f6; }
:where([data-ds]) .ds-table tbody tr[data-tier="1"]:hover { background: #e5e9f1; }
:where([data-ds]) .ds-table tbody tr[data-tier="2"] { background: #dbeafe; }
:where([data-ds]) .ds-table tbody tr[data-tier="2"]:hover { background: #cbdefb; }
:where([data-ds]) .ds-table tbody tr[data-tier="3"] { background: #d8f6e3; }
:where([data-ds]) .ds-table tbody tr[data-tier="3"]:hover { background: #c7f0d8; }
:where([data-ds]) .ds-table tbody tr[data-tier="4"] { background: #fdeeca; }
:where([data-ds]) .ds-table tbody tr[data-tier="4"]:hover { background: #fbe5ae; }
:where([data-ds]) .ds-table tbody tr[data-tier="5"] { background: #f2e5fd; }
:where([data-ds]) .ds-table tbody tr[data-tier="5"]:hover { background: #e9d6fb; }
:where([data-ds]) .ds-table tr[data-tier="1"] .ds-tier-accent { color: #4d5a6d; }
:where([data-ds]) .ds-table tr[data-tier="2"] .ds-tier-accent { color: #1d5fc2; }
:where([data-ds]) .ds-table tr[data-tier="3"] .ds-tier-accent { color: #178a51; }
:where([data-ds]) .ds-table tr[data-tier="4"] .ds-tier-accent { color: #b25f09; }
:where([data-ds]) .ds-table tr[data-tier="5"] .ds-tier-accent { color: #8a2bc7; }
:where([data-ds]) .ds-table .ds-tier-accent { font-weight: var(--ds-weight-strong); font-variant-numeric: tabular-nums; }

/* ===== 色阶图例条：与行级着色配对出现，让人一眼看懂颜色含义 ===== */
:where([data-ds]) .ds-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px var(--ds-page-gutter) 0; }
:where([data-ds]) .ds-legend-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border: 1px solid var(--ds-line); border-radius: 999px; font-size: var(--ds-font-meta); font-weight: var(--ds-weight-medium); white-space: nowrap; }
:where([data-ds]) .ds-legend-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
:where([data-ds]) .ds-legend-chip[data-tier="1"] { background: #f0f2f6; color: #4d5a6d; border-color: #d9dfe9; }
:where([data-ds]) .ds-legend-chip[data-tier="2"] { background: #dbeafe; color: #1d5fc2; border-color: #b6d3fb; }
:where([data-ds]) .ds-legend-chip[data-tier="3"] { background: #d8f6e3; color: #178a51; border-color: #ace9c5; }
:where([data-ds]) .ds-legend-chip[data-tier="4"] { background: #fdeeca; color: #b25f09; border-color: #f6d98f; }
:where([data-ds]) .ds-legend-chip[data-tier="5"] { background: #f2e5fd; color: #8a2bc7; border-color: #dfc0f7; }
/* 不参与着色的说明项：虚线边框表达"排除在外" */
:where([data-ds]) .ds-legend-chip[data-tier="none"] { background: transparent; color: var(--ds-faint); border-style: dashed; }
:where([data-ds]) .ds-legend-chip[data-tier="none"]::before { display: none; }

/* ===== 数字页码分页：首尾常驻 + 当前页窗口 + 省略号，与上一页/下一页并用 ===== */
:where([data-ds]) .ds-page-list { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
:where([data-ds]) .ds-page-num { min-width: 33px; height: 33px; padding: 0 8px; border: 1px solid var(--ds-line-control); border-radius: var(--ds-radius-control); background: var(--ds-white); color: var(--ds-text); font-size: var(--ds-font-control); font-variant-numeric: tabular-nums; line-height: 1.2; cursor: pointer; transition: background-color var(--ds-motion-fast) var(--ds-ease); }
:where([data-ds]) .ds-page-num:hover:not(.ds-page-num--current) { background: var(--ds-hover); }
:where([data-ds]) .ds-page-num:active:not(.ds-page-num--current) { background: var(--ds-selected); }
:where([data-ds]) .ds-page-num--current { background: var(--ds-action); border-color: var(--ds-action); color: var(--ds-white); font-weight: var(--ds-weight-strong); cursor: default; }
:where([data-ds]) .ds-page-ellipsis { padding: 0 3px; color: var(--ds-faint); font-variant-numeric: tabular-nums; user-select: none; }

/* ===== 状态切换标签：语义色胶囊按钮，激活态实心填充；已过滤视图中仅展示当前状态 ===== */
:where([data-ds]) .ds-tag-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 2px 10px; border: 1px solid var(--ds-tone-line, var(--ds-line-control)); border-radius: var(--ds-radius-label); background: var(--ds-tone-bg, var(--ds-white)); color: var(--ds-tone-fg, var(--ds-text)); font-size: var(--ds-font-meta); font-weight: var(--ds-weight-medium); line-height: 1.5; white-space: nowrap; cursor: pointer; transition: background-color var(--ds-motion-fast) var(--ds-ease); }
:where([data-ds]) .ds-tag-btn:hover:not(.ds-tag-btn--on) { background: var(--ds-hover); }
:where([data-ds]) .ds-tag-btn:active:not(.ds-tag-btn--on) { background: var(--ds-selected); }
:where([data-ds]) .ds-tag-btn--on { background: var(--ds-tone-fg, var(--ds-action)); border-color: var(--ds-tone-fg, var(--ds-action)); color: var(--ds-white); }

@media (max-width: 1023px) {
  :where([data-ds]) .ds-shell { grid-template-columns: minmax(0, 1fr); }
  :where([data-ds]) .ds-shell > .ds-sidebar { display: none; }
  :where([data-ds]) .ds-form-layout { grid-template-columns: minmax(0, 1fr); max-width: 800px; }
  :where([data-ds]) .ds-form-sidebar { display: none; }
}
@media (max-width: 767px) {
  :where([data-ds]) :is(.ds-heading, .ds-detail-heading) { align-items: flex-start; flex-wrap: wrap; }
  :where([data-ds]) .ds-heading { min-height: 96px; }
  :where([data-ds]) .ds-viewbar { gap: 12px; }
  :where([data-ds]) .ds-tabs { gap: 12px; }
  :where([data-ds]) .ds-object--large { width: 34px; height: 37px; border-radius: 7px; }
  :where([data-ds]) .ds-object--large .ds-icon { width: 20px; height: 20px; }
  :where([data-ds]) :is(.ds-detail-layout, .ds-form-fields) { grid-template-columns: minmax(0, 1fr); }
  :where([data-ds]) .ds-detail-main { padding-inline-end: 0; }
  :where([data-ds]) .ds-detail-aside { padding-inline-start: 0; border-inline-start: 0; border-top: 1px solid var(--ds-line); }
  :where([data-ds]) .ds-input:not(.ds-filter) { font-size: 16px; }
  :where([data-ds]) .ds-search input { font-size: 16px; }
  :where([data-ds]) .ds-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  :where([data-ds]) .ds-metric:nth-child(odd) { padding-inline-start: 0; border-inline-start: 0; }
  :where([data-ds]) .ds-dialog { max-width: calc(100% - 24px); }
}
