/* 工作台基础样式：只使用 tokens.css 的语义变量。 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--wb-bg);
  color: var(--wb-text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  font-size: var(--wb-font-body);
  line-height: var(--wb-line-height);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.18s ease, color 0.18s ease;
}

body.wb-demo {
  background:
    radial-gradient(1000px 480px at 10% -10%, rgba(232, 74, 60, 0.16), transparent 65%),
    radial-gradient(900px 520px at 100% 0%, rgba(255, 159, 67, 0.1), transparent 58%),
    var(--wb-bg);
}

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

h1 {
  font-size: var(--wb-font-page-title);
  font-weight: var(--wb-font-weight-bold);
  color: var(--wb-text-strong);
}

h2 {
  font-size: var(--wb-font-section-title);
  font-weight: var(--wb-font-weight-bold);
  color: var(--wb-text-strong);
}

h3 {
  font-size: var(--wb-font-body);
  font-weight: var(--wb-font-weight-bold);
}

a {
  color: var(--wb-color-secondary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
[role="button"],
a.wb-button,
summary {
  min-height: var(--wb-touch);
  min-width: var(--wb-touch);
}

button,
.wb-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--wb-space-2);
  border: 1px solid transparent;
  border-radius: var(--wb-radius-control);
  padding: 0 var(--wb-space-4);
  min-height: var(--wb-button-height);
  background: var(--wb-color-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:hover,
.wb-button:hover {
  background: #c93e32;
  text-decoration: none;
}

button:active,
.wb-button:active {
  transform: scale(0.98);
}

button:focus-visible,
.wb-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--wb-color-secondary);
  outline-offset: 2px;
}

button:disabled,
.wb-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

button.wb-secondary,
.wb-button.wb-secondary {
  /* 次级按钮视觉高度 40px 由令牌记录；可触达硬指标优先，实际热区不低于 44px。 */
  min-height: var(--wb-touch);
  background: var(--wb-surface-2);
  color: var(--wb-text);
  border-color: var(--wb-border);
}

button.wb-secondary:hover,
.wb-button.wb-secondary:hover {
  background: var(--wb-surface-3);
}

button.wb-danger,
.wb-button.wb-danger {
  background: var(--wb-color-danger);
}

button.wb-icon,
.wb-icon-button {
  width: var(--wb-icon-button);
  min-width: var(--wb-icon-button);
  height: var(--wb-icon-button);
  min-height: var(--wb-icon-button);
  padding: 0;
  border-radius: var(--wb-radius-pill);
  background: var(--wb-surface-2);
  color: var(--wb-text);
  border-color: var(--wb-border);
}

button.wb-ghost {
  background: transparent;
  color: var(--wb-muted);
  border-color: var(--wb-border);
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--wb-touch);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-control);
  padding: 10px 12px;
  background: var(--wb-surface-2);
  color: var(--wb-text);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--wb-subtle);
}

.wb-card {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-card);
  box-shadow: var(--wb-shadow-soft);
}

.wb-panel {
  padding: var(--wb-space-4);
}

.wb-stack {
  display: grid;
  gap: var(--wb-space-4);
}

.wb-cluster {
  display: flex;
  align-items: center;
  gap: var(--wb-space-2);
  flex-wrap: wrap;
}

.wb-muted {
  color: var(--wb-muted);
  font-size: var(--wb-font-hint);
}

.wb-label {
  color: var(--wb-subtle);
  font-size: var(--wb-font-label);
  letter-spacing: 0.04em;
}

.wb-title {
  color: var(--wb-text-strong);
  font-size: var(--wb-font-page-title);
  font-weight: 700;
}

.wb-section-title {
  color: var(--wb-text-strong);
  font-size: var(--wb-font-section-title);
  font-weight: 700;
}

.wb-metric {
  color: var(--wb-text-strong);
  font-size: var(--wb-font-metric);
  font-weight: 700;
  line-height: 1.1;
}

.wb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: var(--wb-radius-pill);
  font-size: var(--wb-font-label);
  font-weight: 700;
  border: 1px solid var(--wb-border);
  color: var(--wb-muted);
  background: var(--wb-surface-2);
}

.wb-badge.primary {
  color: var(--wb-color-primary);
  background: var(--wb-primary-soft);
  border-color: rgba(232, 74, 60, 0.35);
}

.wb-badge.success {
  color: var(--wb-color-success);
  background: var(--wb-success-soft);
  border-color: rgba(46, 204, 113, 0.35);
}

.wb-badge.warning {
  color: var(--wb-color-warning);
  background: var(--wb-warning-soft);
  border-color: rgba(241, 196, 15, 0.35);
}

.wb-badge.danger {
  color: var(--wb-color-danger);
  background: var(--wb-danger-soft);
  border-color: rgba(231, 76, 60, 0.35);
}

.wb-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wb-space-3);
  padding: var(--wb-space-3) var(--wb-space-4);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-card);
  background: var(--wb-surface-2);
  color: var(--wb-muted);
  font-size: var(--wb-font-hint);
}

.wb-banner.warning {
  background: var(--wb-warning-soft);
  color: var(--wb-text);
  border-color: rgba(241, 196, 15, 0.35);
}

.wb-banner.danger {
  background: var(--wb-danger-soft);
  color: var(--wb-text);
  border-color: rgba(231, 76, 60, 0.35);
}

.wb-demo-note {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px dashed rgba(255, 159, 67, 0.55);
  border-radius: var(--wb-radius-pill);
  color: var(--wb-color-secondary);
  background: var(--wb-secondary-soft);
  font-size: var(--wb-font-label);
}

/* 既有 shared/ 组件是浅色背景，用统一外壳降低暗色模式的跳色。 */
.wb-legacy-embed {
  color-scheme: light;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius-card);
  padding: var(--wb-space-2);
  overflow: auto;
}

[data-theme="dark"] .wb-legacy-embed {
  filter: brightness(0.9) saturate(0.92);
}

.wb-legacy-embed > * {
  display: block;
  width: 100%;
}

.wb-scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 767px) {
  body {
    font-size: var(--wb-font-body);
  }
  .wb-panel {
    padding: var(--wb-space-3);
  }
}
