:root {
  --wb-primary: #5b43ef;
  --wb-primary-hover: #4630d0;
  --wb-primary-soft: #f0edff;
  --wb-page: #eef2ff;
  --wb-app: #f8f9ff;
  --wb-surface: #fff;
  --wb-surface-muted: #f7f8fe;
  --wb-surface-hover: #f3f1ff;
  --wb-text: #182142;
  --wb-text-secondary: #7180a5;
  --wb-text-muted: #9aa6c5;
  --wb-border: #e5e9f8;
  --wb-border-strong: #d7ddf1;
  --wb-success: #25a55f;
  --wb-success-bg: #eaf8f0;
  --wb-warning: #c47a13;
  --wb-warning-bg: #fff5df;
  --wb-error: #d94b5b;
  --wb-error-hover: #c53649;
  --wb-error-bg: #fff0f2;
  --wb-font: Inter, "Noto Sans SC", "Noto Sans TC", "PingFang SC", "PingFang TC", "Microsoft YaHei", system-ui, sans-serif;
  --wb-mono: SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --rail: 188px;
  --topbar: 58px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --shadow: 0 14px 34px rgba(62, 73, 135, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--wb-text);
  background: linear-gradient(180deg, #fbfcff 0%, var(--wb-page) 100%);
  font-family: var(--wb-font);
  font-size: 13px;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  color: #fff;
  background: linear-gradient(180deg, #293eb2 0%, #5c62d2 56%, #aabaf2 100%);
  box-shadow: 18px 0 45px rgba(54, 64, 143, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 18px;
  font-weight: 800;
  font-size: 15px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.rail-nav {
  display: grid;
  gap: 7px;
}

.rail-item {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.84);
  font-weight: 750;
}

.rail-item:hover,
.rail-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.rail-item.disabled {
  color: rgba(255, 255, 255, 0.42);
}

.rail-note {
  margin-top: auto;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 10px 18px;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 225, 168, 0.78), transparent 18%),
    linear-gradient(180deg, transparent 0%, rgba(39, 58, 145, 0.34) 100%);
}

.rail-note strong {
  font-size: 14px;
  margin-bottom: 4px;
}

.rail-note span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--rail);
  right: 0;
  z-index: 10;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid var(--wb-border);
  background: rgba(250, 251, 255, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 30px rgba(42, 54, 102, 0.06);
}

.crumbs {
  width: 430px;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumbs span {
  color: var(--wb-text-secondary);
  margin: 0 8px;
}

.global-search {
  flex: 1;
  max-width: 470px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.global-search input,
.filter-row input,
.filter-row select,
label input,
label select,
label textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--wb-text);
  padding: 8px 10px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--wb-primary);
  box-shadow: 0 0 0 3px rgba(91, 67, 239, 0.1);
}

button {
  min-height: 36px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  color: #39436f;
  padding: 0 13px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(42, 54, 102, 0.05);
}

button:hover {
  border-color: var(--wb-primary);
}

button:disabled,
button:disabled:hover {
  border-color: var(--wb-border);
  background: #eef2fb;
  color: var(--wb-text-secondary);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.72;
}

button.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #7460ff 0%, var(--wb-primary) 100%);
  box-shadow: 0 10px 24px rgba(91, 67, 239, 0.24);
}

.button-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: #39436f;
  font-size: 13px;
  font-weight: 800;
}

.button-link.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #7460ff 0%, var(--wb-primary) 100%);
  color: #fff;
}

.top-actions form {
  margin: 0;
}

.topbar-spacer {
  flex: 1;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(140deg, rgba(41, 62, 178, 0.08), transparent 34%),
    linear-gradient(180deg, #fbfcff 0%, #eef2ff 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: var(--wb-surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand .brand-mark {
  color: #fff;
  background: linear-gradient(135deg, #293eb2 0%, #5b43ef 100%);
}

.login-brand h1 {
  margin: 2px 0 0;
  font-size: 22px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  font-weight: 800;
}

.login-form button {
  width: 100%;
  margin-top: 4px;
}

button.primary:disabled,
button.primary:disabled:hover {
  border-color: transparent;
  background: #dfe4f2;
  color: #7b86a8;
}

button.danger {
  border-color: transparent;
  background: var(--wb-error);
  color: #fff;
  box-shadow: 0 10px 24px rgba(217, 75, 91, 0.22);
}

button.danger:hover {
  border-color: transparent;
  background: var(--wb-error-hover);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-actions button,
.global-search button {
  width: 38px;
  min-width: 38px;
  flex: 0 0 38px;
  padding: 0;
}

.workspace {
  margin-left: var(--rail);
  padding-top: var(--topbar);
  min-height: 100vh;
}

.two-pane {
  height: 100vh;
  display: flex;
  gap: 0;
  padding: calc(var(--topbar) + 14px) 18px 18px calc(var(--rail) + 18px);
  margin-left: 0;
  overflow: hidden;
}

.list-pane {
  width: 326px;
  flex: 0 0 326px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.two-pane.list-only .list-pane {
  width: auto;
  flex: 1 1 auto;
  border-radius: var(--radius-lg);
}

.two-pane.list-only .filter-row {
  grid-template-columns: minmax(280px, 1fr) 110px;
  align-items: center;
}

.two-pane.list-only .result-item {
  min-height: 62px;
}

.two-pane.list-only .result-main {
  grid-template-columns: minmax(220px, 0.6fr) minmax(260px, 1fr) minmax(220px, 0.7fr);
  align-items: center;
  width: 100%;
}

.words-table {
  margin: 0 16px 16px;
}

.words-table table {
  table-layout: fixed;
}

.words-table th:nth-child(1) {
  width: 76px;
}

.words-table th:nth-child(2) {
  width: 24%;
}

.words-table th:nth-child(3) {
  width: 14%;
}

.words-table th:nth-child(4) {
  width: 28%;
}

.words-table th:nth-child(5) {
  width: 190px;
}

.words-table th:nth-child(6) {
  width: 86px;
}

.words-table td {
  vertical-align: middle;
}

.words-table td,
.words-table .table-link {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.words-table .table-link {
  display: block;
  color: var(--wb-text);
}

.words-table .table-link:hover {
  color: var(--wb-primary);
}

.words-table tr.selected td {
  background: var(--wb-primary-soft);
}

.senses-table th:nth-child(2) {
  width: 34%;
}

.senses-table th:nth-child(3) {
  width: 22%;
}

.senses-table th:nth-child(4),
.senses-table th:nth-child(5) {
  width: 86px;
}

.domain-list {
  width: 360px;
  flex-basis: 360px;
}

.audit-list-pane {
  width: 420px;
  flex-basis: 420px;
}

.editor-pane {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--wb-border);
  border-left: 0;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
  overflow: auto;
}

.pane-head,
.editor-head,
.subpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pane-head {
  padding: 21px 20px 14px;
}

.pane-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--wb-text-secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: 22px;
}

h2 {
  max-width: min(520px, 46vw);
  font-size: 23px;
  line-height: 1.25;
}

h3 {
  font-size: 14px;
}

.count,
.save-state {
  min-width: 26px;
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  background: var(--wb-primary-soft);
  color: var(--wb-primary);
  padding: 4px 8px;
  font-weight: 850;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 0 16px 14px;
}

.filter-row button {
  width: 100%;
}

.search-hint {
  margin: -4px 16px 12px;
  color: var(--wb-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.result-list {
  min-height: 0;
  overflow: auto;
  padding: 0 10px 14px;
}

.result-item {
  position: relative;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 6px;
  padding: 12px;
  border: 1px solid transparent;
  border-bottom-color: var(--wb-border);
  border-radius: var(--radius);
}

.result-item.compact {
  min-height: 60px;
}

.result-item:hover {
  background: var(--wb-surface-hover);
}

.result-item.selected {
  border-color: rgba(91, 67, 239, 0.24);
  background: linear-gradient(135deg, rgba(245, 242, 255, 0.96), rgba(255, 255, 255, 0.76));
  box-shadow: 0 12px 24px rgba(91, 67, 239, 0.11);
}

.result-item.selected::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  border-radius: 999px;
  background: var(--wb-primary);
}

.result-item.deprecated,
.words-table tr.deprecated {
  opacity: 0.68;
}

.result-item.deprecated {
  background: var(--wb-error-bg);
}

.words-table tr.deprecated td {
  background: var(--wb-error-bg);
}

.result-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.result-main strong,
.result-main small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.result-main small,
.subtle {
  color: var(--wb-text-secondary);
}

.empty-small,
.empty-state {
  padding: 28px;
  color: var(--wb-text-secondary);
}

.editor {
  min-height: 100%;
}

.editor-head {
  min-height: 94px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid rgba(229, 233, 248, 0.72);
  background: rgba(255, 255, 255, 0.8);
}

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

.mobile-back-link {
  display: none;
}

.tabs {
  display: flex;
  gap: 26px;
  min-height: 50px;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--wb-border);
  background: rgba(255, 255, 255, 0.6);
  color: var(--wb-text-secondary);
  font-weight: 800;
}

.tabs .active {
  align-self: stretch;
  display: flex;
  align-items: center;
  color: var(--wb-primary);
  border-bottom: 3px solid var(--wb-primary);
}

.editor-body {
  display: grid;
  gap: 16px;
  padding: 24px 28px 30px;
}

.form-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.priority-section {
  border-color: rgba(91, 67, 239, 0.22);
  background: linear-gradient(180deg, #fff 0%, rgba(248, 249, 255, 0.92) 100%);
}

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

.section-head h3 {
  font-size: 15px;
}

.priority-grid,
.compact-grid,
.support-grid,
.technical-grid {
  display: grid;
  gap: 14px;
}

.priority-grid {
  grid-template-columns: minmax(220px, 1.15fr) minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(150px, 0.7fr);
  align-items: start;
}

.compact-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

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

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

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--wb-text-secondary);
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  min-width: 0;
}

.field-xl input {
  min-height: 46px;
  color: var(--wb-text);
  font-size: 16px;
  font-weight: 850;
}

.field-definition {
  grid-column: 1 / -1;
}

.field-definition textarea {
  min-height: 132px;
  color: var(--wb-text);
  font-weight: 700;
  line-height: 1.6;
}

.field-notes textarea,
.technical-grid textarea {
  min-height: 138px;
}

.audit-note {
  padding: 0 2px;
}

.editor-body-guided {
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: start;
  gap: 22px;
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.78), rgba(255, 255, 255, 0.94));
}

.guided-sections {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.guided-section {
  grid-template-columns: minmax(154px, 0.28fr) minmax(0, 1fr);
  gap: 22px;
  padding: 20px;
  border-color: rgba(214, 221, 239, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(31, 42, 68, 0.04);
}

.guided-section.priority-section {
  border-color: rgba(214, 221, 239, 0.95);
  background: rgba(255, 255, 255, 0.96);
}

.guided-section .section-head {
  align-items: start;
  justify-content: start;
}

.guided-section .section-head h3 {
  color: var(--wb-text);
  font-size: 15px;
  line-height: 1.2;
}

.guided-section .section-head p {
  margin-top: 6px;
  color: var(--wb-text-secondary);
  font-size: 12px;
  line-height: 1.4;
}

.section-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 6px;
  background: var(--wb-primary-soft);
  color: var(--wb-primary);
  font-size: 14px;
  font-weight: 900;
}

.section-fields {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.guided-field {
  display: grid;
  grid-template-columns: minmax(118px, 0.34fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  min-width: 0;
}

.field-copy {
  display: grid;
  gap: 5px;
  align-content: start;
  min-width: 0;
  color: var(--wb-text);
  font-weight: 850;
  line-height: 1.35;
}

.field-copy small {
  color: var(--wb-text-secondary);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.field-warning {
  grid-column: 2;
  color: var(--wb-error);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.guided-field input,
.guided-field select,
.guided-field textarea,
.input-action {
  min-width: 0;
}

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

.guided-field .compact-textarea {
  min-height: 72px;
}

.textarea-field textarea {
  min-height: 116px;
}

.readonly-value {
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--wb-border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--wb-text);
  padding: 8px 10px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.readonly-value.multiline {
  align-items: flex-start;
  min-height: 116px;
  white-space: pre-wrap;
}

.readonly-value.reading-value {
  font-size: 18px;
}

.action-field {
  align-items: center;
}

.semantic-field {
  align-items: center;
}

.semantic-select {
  font-family: var(--wb-sans);
}

.tag-editor {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.tag-list {
  min-height: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--wb-border-strong);
  border-radius: 8px;
  background: #fff;
  padding: 7px;
}

.tag-token {
  min-width: 0;
  max-width: 100%;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(91, 67, 239, 0.16);
  border-radius: 999px;
  background: var(--wb-primary-soft);
  color: var(--wb-primary);
  padding: 0 6px 0 9px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
}

.tag-token span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-remove {
  position: relative;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: rgba(91, 67, 239, 0.1);
  color: var(--wb-primary);
  padding: 0;
  box-shadow: none;
  font-size: 0;
  font-weight: 900;
  line-height: 0;
}

.tag-remove::before {
  content: "×";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -53%);
  font-size: 14px;
  line-height: 1;
}

.tag-remove:hover,
.tag-remove:focus-visible {
  background: rgba(217, 75, 91, 0.1);
  color: var(--wb-error);
}

.tag-empty {
  color: var(--wb-text-muted);
  font-size: 12px;
  font-weight: 750;
}

.tag-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tag-entry select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--wb-text);
  padding: 8px 10px;
  outline: none;
}

.tag-entry button {
  min-width: 58px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.placeholder-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--wb-border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--wb-text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.placeholder-button:hover,
.placeholder-button:focus-visible {
  border-color: var(--wb-text);
  background: #fff;
  color: var(--wb-text);
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.choice-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  flex: 1 1 62px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--wb-border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--wb-text-secondary);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.choice-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.choice-option span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.choice-option:has(input:checked) {
  border-color: var(--wb-primary);
  background: var(--wb-primary-soft);
  color: var(--wb-primary);
  box-shadow: 0 8px 18px rgba(91, 67, 239, 0.12);
}

.choice-option:has(input:focus-visible) {
  outline: 2px solid var(--wb-primary);
  outline-offset: 2px;
}

.yes-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  cursor: pointer;
}

.yes-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.yes-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 64px;
  height: 32px;
  border: 1px solid var(--wb-border-strong);
  border-radius: 999px;
  background: #eef2ff;
  color: var(--wb-text-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 1px 2px rgba(28, 39, 76, 0.08);
  transition: background 140ms ease, border-color 140ms ease;
}

.yes-switch-label {
  position: absolute;
  z-index: 1;
  width: 34px;
  text-align: center;
  line-height: 1;
  pointer-events: none;
}

.yes-switch-label-on {
  left: 5px;
  color: #fff;
  opacity: 0;
}

.yes-switch-label-off {
  right: 4px;
  color: var(--wb-text-muted);
  opacity: 1;
}

.yes-switch-thumb {
  position: absolute;
  z-index: 2;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(28, 39, 76, 0.22);
  transition: transform 140ms ease;
}

.yes-switch input:checked + .yes-switch-track {
  border-color: var(--wb-primary);
  background: var(--wb-primary);
}

.yes-switch input:checked + .yes-switch-track .yes-switch-thumb {
  transform: translateX(32px);
}

.yes-switch input:checked + .yes-switch-track .yes-switch-label-on {
  opacity: 1;
}

.yes-switch input:checked + .yes-switch-track .yes-switch-label-off {
  opacity: 0;
}

.yes-switch input:focus-visible + .yes-switch-track {
  outline: 2px solid var(--wb-primary);
  outline-offset: 2px;
}

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

.expanded-fields .textarea-field,
.expanded-fields .guided-field:last-child {
  grid-column: 1 / -1;
}

.guided-audit {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.editor-page-nav {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
  padding-top: 4px;
  color: var(--wb-text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.editor-page-nav span {
  color: var(--wb-text);
}

.editor-page-nav a {
  position: relative;
  display: block;
  padding-left: 18px;
  color: var(--wb-text-secondary);
  line-height: 1.4;
}

.editor-page-nav a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #d5dae9;
}

.editor-page-nav a.active,
.editor-page-nav a:hover {
  color: var(--wb-primary);
}

.editor-page-nav a.active::before,
.editor-page-nav a:hover::before {
  background: var(--wb-primary);
}

.sense-focus {
  display: grid;
  grid-template-columns: minmax(180px, 0.34fr) minmax(0, 1fr);
  gap: 18px;
}

.focus-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: var(--wb-surface-muted);
}

.focus-card span {
  color: var(--wb-text-secondary);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.focus-card strong {
  color: var(--wb-text);
  line-height: 1.45;
}

.reading-focus strong {
  font-size: 30px;
}

.gloss-focus {
  min-height: 210px;
}

.gloss-focus strong {
  font-size: 22px;
}

.field-grid,
.readonly-grid,
.inline-form,
.drawer-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 18px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--wb-text-secondary);
  font-weight: 750;
}

.full,
.span-2 {
  grid-column: span 2;
}

.mono,
.mono-input {
  font-family: var(--wb-mono);
}

.readonly-grid div {
  min-height: 74px;
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: var(--wb-surface-muted);
}

.readonly-grid span {
  color: var(--wb-text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.readonly-grid strong {
  line-height: 1.45;
}

.secondary-grid strong {
  font-size: 13px;
}

.subpanel,
.audit {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: var(--wb-surface-muted);
}

.inline-form,
.drawer-form {
  align-items: end;
}

.drawer-form {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--wb-border-strong);
  border-radius: var(--radius);
  background: #fff;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: #fff;
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--wb-border);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--wb-text-secondary);
  background: var(--wb-surface-muted);
  font-size: 12px;
  font-weight: 850;
}

.row-actions {
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  background: var(--wb-primary-soft);
  color: var(--wb-primary);
  font-weight: 800;
  white-space: nowrap;
}

.chip.reviewed,
.status-dot.reviewed {
  background: var(--wb-success-bg);
  color: var(--wb-success);
}

.chip.needs_review,
.chip.disputed,
.status-dot.needs_review,
.status-dot.disputed {
  background: var(--wb-warning-bg);
  color: var(--wb-warning);
}

.chip.rejected,
.chip.deprecated,
.status-dot.rejected,
.status-dot.deprecated {
  background: var(--wb-error-bg);
  color: var(--wb-error);
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  border-radius: 999px;
  background: currentColor;
  color: var(--wb-primary);
}

.alert {
  margin: 16px 28px 0;
  padding: 11px 12px;
  border-radius: var(--radius);
  font-weight: 750;
}

.alert.error {
  color: var(--wb-error);
  background: var(--wb-error-bg);
}

.audit-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--wb-border);
}

.audit-row:last-child {
  border-bottom: 0;
}

.audit-row span,
.audit-row p {
  margin: 0;
  color: var(--wb-text-secondary);
}

.audit-result-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.audit-result {
  min-height: 82px;
}

.audit-result .result-main {
  gap: 3px;
}

.audit-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.audit-action-badge,
.audit-entity-badge {
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.audit-action-badge.added {
  color: #147a45;
  background: #e8f8ef;
}

.audit-action-badge.modified,
.audit-action-badge.default {
  color: #94610f;
  background: #fff4dc;
}

.audit-action-badge.deleted,
.audit-action-badge.rejected {
  color: #b83245;
  background: #fff0f2;
}

.audit-action-badge.reviewed,
.audit-action-badge.restored {
  color: #4b37c9;
  background: var(--wb-primary-soft);
}

.audit-entity-badge {
  color: #53638e;
  background: #eef2fb;
}

.audit-detail-pane .editor {
  min-height: 100%;
}

.audit-field,
.audit-change-card,
.audit-entry-panel,
.audit-changes-panel {
  border: 1px solid var(--wb-border);
  border-radius: var(--radius);
  background: var(--wb-surface-muted);
}

.audit-field span,
.audit-diff span {
  color: var(--wb-text-secondary);
  font-size: 12px;
  font-weight: 850;
}

.audit-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.audit-entry-panel,
.audit-changes-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

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

.audit-field {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 74px;
  padding: 13px;
  background: #fff;
}

.audit-change-list {
  display: grid;
  gap: 12px;
}

.audit-change-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  background: #fff;
}

.audit-change-card h4 {
  margin: 0;
  font-size: 15px;
}

.audit-diff {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.audit-diff div {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--wb-surface-muted);
}

.audit-diff div:first-child {
  background: #fff6f7;
}

.audit-diff div:last-child {
  background: var(--wb-success-bg);
}

.audit-diff p {
  margin: 0;
  min-height: 22px;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--wb-border);
  background: rgba(255, 255, 255, 0.72);
}

.pager-button {
  min-width: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--wb-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #39436f;
  padding: 0 10px;
  font-weight: 800;
}

.pager-button.disabled {
  color: var(--wb-text-muted);
  background: #eef2fb;
}

.pager-status {
  color: var(--wb-text-secondary);
  font-weight: 800;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--wb-border);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px;
  font-weight: 800;
}

.pill small {
  color: var(--wb-text-secondary);
  font-weight: 700;
}

.domain-description {
  margin: 0;
  color: var(--wb-text-secondary);
  line-height: 1.6;
}

@media (max-width: 1100px) {
  .rail {
    width: 154px;
  }

  :root {
    --rail: 154px;
  }

  .crumbs {
    width: 260px;
  }

  .two-pane {
    flex-direction: column;
    overflow: auto;
  }

  .list-pane,
  .domain-list,
  .audit-list-pane,
  .editor-pane {
    width: 100%;
    flex: none;
    border-radius: var(--radius-lg);
    border: 1px solid var(--wb-border);
  }

  .list-pane {
    max-height: 42vh;
  }

  .two-pane.list-only .list-pane {
    max-height: none;
  }

  .two-pane.list-only .filter-row,
  .two-pane.list-only .result-main {
    grid-template-columns: 1fr;
  }

  .words-table table {
    min-width: 960px;
  }

  .editor-body-guided,
  .guided-section,
  .guided-field,
  .expanded-fields {
    grid-template-columns: 1fr;
  }

  .editor-page-nav {
    display: none;
  }

  .field-grid,
  .field-grid.wide,
  .priority-grid,
  .compact-grid,
  .audit-field-grid,
  .audit-diff,
  .support-grid,
  .technical-grid,
  .sense-focus,
  .readonly-grid,
  .inline-form,
  .drawer-form {
    grid-template-columns: 1fr;
  }

  .full,
  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 700px) {
  :root {
    --rail: 0px;
    --mobile-rail: 56px;
    --topbar: 54px;
  }

  html,
  body {
    font-size: 14px;
  }

  body {
    background: var(--wb-app);
  }

  .rail {
    inset: 0 0 auto 0;
    width: 100%;
    height: var(--mobile-rail);
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(90deg, #293eb2 0%, #5c62d2 100%);
    overflow-x: auto;
    box-shadow: 0 8px 22px rgba(54, 64, 143, 0.16);
    scrollbar-width: none;
  }

  .rail::-webkit-scrollbar {
    display: none;
  }

  .brand {
    flex: 0 0 auto;
    gap: 7px;
    padding: 0 4px 0 0;
    font-size: 14px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .rail-nav {
    display: flex;
    gap: 6px;
    min-width: 0;
  }

  .rail-item {
    height: 38px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 13px;
    white-space: nowrap;
  }

  .rail-item.disabled,
  .rail-note {
    display: none;
  }

  .topbar {
    top: var(--mobile-rail);
    left: 0;
    gap: 8px;
    padding: 8px 10px;
    height: var(--topbar);
    align-items: stretch;
    background: rgba(250, 251, 255, 0.96);
  }

  .crumbs {
    display: none;
  }

  .global-search {
    min-width: 0;
    max-width: none;
    margin-left: 0;
    gap: 6px;
  }

  .global-search input,
  .filter-row input,
  .filter-row select,
  label input,
  label select,
  label textarea {
    min-height: 40px;
    font-size: 16px;
  }

  button,
  .button-link,
  .pager-button {
    min-height: 40px;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions button,
  .global-search button {
    width: 40px;
    min-width: 40px;
    flex-basis: 40px;
  }

  .top-actions button[aria-label="主题"],
  .top-actions button[aria-label="帮助"] {
    display: none;
  }

  .top-actions form button {
    width: auto;
    min-width: 50px;
    padding: 0 10px;
  }

  .workspace {
    margin-left: 0;
    padding-top: calc(var(--mobile-rail) + var(--topbar));
  }

  .two-pane {
    height: auto;
    min-height: 100vh;
    gap: 12px;
    padding: calc(var(--mobile-rail) + var(--topbar) + 10px) 10px 14px;
    overflow: visible;
  }

  .list-pane {
    max-height: min(50vh, 430px);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(42, 54, 102, 0.08);
  }

  .two-pane.list-only .list-pane {
    max-height: none;
  }

  .word-workspace.mobile-detail .list-pane,
  .audit-workspace.mobile-detail .list-pane {
    display: none;
  }

  .word-workspace.mobile-detail .editor-pane,
  .audit-workspace.mobile-detail .editor-pane {
    width: 100%;
  }

  .audit-workspace:not(.mobile-detail) .editor-pane {
    display: none;
  }

  .audit-workspace:not(.mobile-detail) {
    min-height: auto;
  }

  .audit-workspace:not(.mobile-detail) .audit-list-pane {
    max-height: none;
  }

  .mobile-back-link {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    margin: 0 0 8px;
    color: var(--wb-primary);
    font-size: 13px;
    font-weight: 850;
  }

  .mobile-back-link::before {
    content: "‹";
    margin-right: 6px;
    font-size: 20px;
    line-height: 1;
  }

  .pane-head {
    padding: 16px 14px 10px;
  }

  .pane-head,
  .editor-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    min-height: auto;
    padding: 16px 14px;
  }

  .editor-pane {
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(42, 54, 102, 0.08);
  }

  .editor-actions,
  .pane-head-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .editor-actions button {
    flex: 1 1 112px;
  }

  .filter-row {
    padding: 0 14px 12px;
  }

  .search-hint {
    margin: -2px 14px 10px;
  }

  .result-list {
    padding: 0 8px 10px;
  }

  .result-item,
  .two-pane.list-only .result-item {
    min-height: 66px;
    margin: 0;
    padding: 11px 10px;
  }

  .form-section {
    padding: 14px;
  }

  .guided-section {
    gap: 14px;
    padding: 14px;
  }

  .guided-section .section-head {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
  }

  .section-fields,
  .guided-sections {
    gap: 14px;
  }

  .guided-field {
    gap: 8px;
  }

  .field-warning {
    grid-column: 1;
  }

  .choice-option {
    flex-basis: calc(50% - 4px);
  }

  .tag-entry {
    grid-template-columns: 1fr;
  }

  .tag-entry button,
  .action-field button {
    width: 100%;
  }

  .readonly-grid div,
  .audit-field {
    min-height: auto;
  }

  .subpanel,
  .audit,
  .audit-entry-panel,
  .audit-changes-panel,
  .audit-change-card {
    padding: 14px;
  }

  .subpanel-head {
    align-items: flex-start;
  }

  .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    white-space: normal;
  }

  .row-actions button {
    flex: 1 1 72px;
  }

  .table-wrap {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 680px;
  }

  .words-table {
    margin: 0 10px 12px;
  }

  .words-table table {
    min-width: 760px;
  }

  .audit-result {
    min-height: 76px;
  }

  .audit-meta-badges {
    gap: 4px;
  }

  .pager {
    padding: 10px;
  }

  .login-shell {
    align-items: start;
    padding: 18px 14px;
  }

  .login-panel {
    padding: 22px 18px;
  }

  h2 {
    max-width: 100%;
    font-size: 20px;
  }

  h1 {
    font-size: 20px;
  }

  .tabs,
  .editor-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .editor-body {
    gap: 14px;
    padding-top: 14px;
    padding-bottom: 18px;
  }
}

@media (max-width: 420px) {
  .brand span:last-child {
    display: none;
  }

  .rail-item {
    padding: 0 10px;
  }

  .top-actions form button {
    min-width: 46px;
    padding: 0 8px;
  }

  .pane-head,
  .editor-head,
  .subpanel-head {
    gap: 10px;
  }

  .choice-option {
    flex-basis: 100%;
  }

  .audit-diff div,
  .readonly-grid div {
    padding: 11px;
  }
}
