:root {
  color-scheme: light;
  --ink-950: #0b1724;
  --ink-900: #132335;
  --ink-800: #203449;
  --ink-700: #40556a;
  --ink-500: #6a7b8c;
  --ink-300: #b6c1ca;
  --ink-200: #d5dde2;
  --ink-100: #e7ecef;
  --paper: #f8fafb;
  --white: #ffffff;
  --blue-700: #155c83;
  --blue-600: #19729f;
  --blue-100: #dceef7;
  --amber-600: #b46d0a;
  --amber-400: #f3ae36;
  --amber-100: #fff1d5;
  --red-700: #a83b32;
  --red-100: #fae5e2;
  --green-700: #237158;
  --green-100: #dff2e9;
  --purple-700: #6e4a8c;
  --purple-100: #eee6f4;
  --shadow: 0 20px 50px rgba(20, 38, 55, 0.1);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  background: #e9eef1;
  color: var(--ink-950);
  font-size: 16px;
}

body {
  min-height: 100vh;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(18, 36, 53, 0.028) 1px, transparent 1px) 0 0 / 36px 36px,
    linear-gradient(rgba(18, 36, 53, 0.028) 1px, transparent 1px) 0 0 / 36px 36px,
    #edf1f3;
}

.topbar {
  height: 76px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--white);
  background: var(--ink-950);
  border-bottom: 3px solid var(--amber-400);
}

.brand-block,
.topbar-actions,
.connection-state,
.item-header,
.item-tags,
.section-heading-row,
.decision-footer,
.queue-header,
.pager-actions,
.progress-copy {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink-950);
  background: var(--amber-400);
  border-radius: 11px 11px 4px 11px;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0.04em;
}

.brand-block p {
  margin: 2px 0 0;
  color: var(--ink-300);
  font-size: 0.8rem;
}

.topbar-actions {
  gap: 18px;
}

.connection-state {
  gap: 8px;
  color: var(--ink-200);
  font-size: 0.86rem;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber-400);
  box-shadow: 0 0 0 4px rgba(243, 174, 54, 0.16);
}

.connection-state.online .state-dot {
  background: #50d6a2;
  box-shadow: 0 0 0 4px rgba(80, 214, 162, 0.15);
}

.connection-state.offline .state-dot {
  background: #ef756b;
  box-shadow: 0 0 0 4px rgba(239, 117, 107, 0.15);
}

.review-layout {
  height: calc(100vh - 76px);
  height: calc(100dvh - 76px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(500px, 1fr) minmax(270px, 330px);
}

.review-layout > * {
  min-height: 0;
}

.filter-panel,
.queue-panel {
  min-width: 0;
  background: rgba(248, 250, 251, 0.92);
}

.filter-panel {
  padding: 24px 20px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  border-right: 1px solid var(--ink-200);
}

.queue-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--ink-200);
}

.panel-heading,
.queue-header {
  justify-content: space-between;
}

.panel-heading {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}

.eyebrow,
.section-kicker {
  color: var(--ink-700);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field-label {
  display: block;
  margin: 18px 0 7px;
  color: var(--ink-700);
  font-size: 0.82rem;
  font-weight: 700;
}

.select-control,
.text-control,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink-950);
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.select-control:focus,
.text-control:focus,
textarea:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(25, 114, 159, 0.13);
}

.field-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 10px;
}

.search-wrap {
  position: relative;
}

.search-wrap > span {
  position: absolute;
  left: 11px;
  top: 9px;
  color: var(--ink-500);
  font-size: 1.15rem;
}

.search-wrap input {
  padding-left: 34px;
}

.progress-card {
  margin-top: 16px;
  padding: 14px;
  background: var(--ink-900);
  color: var(--white);
  border-radius: var(--radius-md);
}

.progress-copy {
  justify-content: space-between;
  gap: 12px;
}

.progress-copy strong {
  font-size: 1.05rem;
}

.progress-copy span {
  color: var(--ink-300);
  font-size: 0.78rem;
}

.progress-track {
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--amber-400);
  transition: width 180ms ease;
}

.status-filter {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
}

.status-filter legend {
  margin-bottom: 7px;
  color: var(--ink-700);
  font-size: 0.82rem;
  font-weight: 700;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  background: var(--ink-100);
  border-radius: 10px;
}

.segmented-control button {
  min-height: 34px;
  padding: 6px;
  color: var(--ink-700);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
}

.segmented-control button.active {
  color: var(--ink-950);
  background: var(--white);
  box-shadow: 0 1px 5px rgba(14, 30, 45, 0.12);
}

.filter-footnote {
  margin-top: 24px;
  padding-top: 16px;
  color: var(--ink-500);
  border-top: 1px solid var(--ink-200);
  font-size: 0.75rem;
  line-height: 2;
}

.keycap {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  margin: 0 2px;
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-weight: 800;
}

.workbench {
  min-width: 0;
  padding: 28px clamp(20px, 3vw, 48px) 90px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.review-card {
  max-width: 920px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(182, 193, 202, 0.75);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.item-header {
  min-height: 72px;
  padding: 16px 22px;
  justify-content: space-between;
  gap: 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--ink-200);
}

.item-tags {
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--ink-700);
  background: var(--ink-100);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.025em;
}

.tag.high {
  color: var(--red-700);
  background: var(--red-100);
}

.tag.medium {
  color: var(--amber-600);
  background: var(--amber-100);
}

.tag.low {
  color: var(--blue-700);
  background: var(--blue-100);
}

.copy-id {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding: 0;
  color: var(--ink-500);
  background: none;
  border: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.position-indicator {
  flex: 0 0 auto;
  color: var(--ink-500);
  font-size: 0.8rem;
}

.sentence-section,
.risk-section,
.decision-section {
  padding: 24px 28px;
}

.sentence-section,
.risk-section {
  border-bottom: 1px solid var(--ink-100);
}

.sentence {
  margin: 18px 0 22px;
  color: var(--ink-950);
  font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  line-height: 1.85;
  letter-spacing: 0.025em;
}

.sentence mark {
  display: inline-block;
  margin: 0 3px;
  padding: 0 6px;
  color: var(--ink-950);
  background: linear-gradient(180deg, transparent 9%, var(--amber-400) 9%, var(--amber-400) 91%, transparent 91%);
  border-radius: 4px;
  font-weight: 800;
}

.target-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--ink-200);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
}

.target-summary > div {
  min-width: 0;
  padding: 12px 14px;
  background: var(--paper);
}

.target-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-500);
  font-size: 0.72rem;
}

.target-summary strong {
  display: block;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinyin-value {
  color: var(--blue-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pinyin-value.muted {
  color: var(--ink-700);
}

.section-heading-row {
  justify-content: space-between;
  gap: 16px;
}

.text-button {
  padding: 0;
  color: var(--blue-700);
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  font-weight: 700;
}

.risk-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.risk-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  padding: 12px 14px;
  background: var(--paper);
  border-left: 3px solid var(--ink-300);
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
}

.risk-item.high {
  border-left-color: var(--red-700);
}

.risk-item.medium {
  border-left-color: var(--amber-400);
}

.risk-item.low {
  border-left-color: var(--blue-600);
}

.risk-code {
  padding-top: 2px;
  color: var(--ink-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
}

.risk-copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.87rem;
}

.risk-copy p {
  margin: 0;
  color: var(--ink-700);
  font-size: 0.81rem;
  line-height: 1.55;
}

.raw-details {
  max-height: 280px;
  margin: 12px 0 0;
  padding: 14px;
  overflow: auto;
  color: #d8e6ee;
  background: var(--ink-950);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.save-state {
  color: var(--ink-500);
  font-size: 0.8rem;
}

.save-state.saved {
  color: var(--green-700);
  font-weight: 700;
}

.reviewer-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin: 14px 0;
}

.reviewer-row .field-label {
  margin-top: 0;
}

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

.decision-button {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--ink-950);
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.decision-button:hover {
  transform: translateY(-1px);
  border-color: var(--ink-300);
}

.decision-button.keep:hover,
.decision-button.keep.selected {
  background: var(--green-100);
  border-color: #83bea8;
}

.decision-button.change:hover,
.decision-button.change.selected {
  background: var(--blue-100);
  border-color: #78afc9;
}

.decision-button.drop:hover,
.decision-button.drop.selected {
  background: var(--red-100);
  border-color: #d89892;
}

.decision-button.defer:hover,
.decision-button.defer.selected {
  background: var(--amber-100);
  border-color: #dfb76e;
}

.decision-key {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink-700);
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 800;
}

.decision-button strong,
.decision-button small {
  display: block;
}

.decision-button strong {
  font-size: 0.9rem;
}

.decision-button small {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: 0.72rem;
}

.change-control {
  min-height: 58px;
  padding: 7px;
  background: var(--paper);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
}

.change-control > label {
  display: block;
  margin: 0 0 5px 4px;
  color: var(--ink-500);
  font-size: 0.7rem;
  font-weight: 700;
}

.change-control > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.change-control .text-control {
  min-height: 38px;
  padding-block: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.change-control .decision-button {
  min-height: 38px;
  padding-block: 6px;
}

.notes-field {
  display: block;
  margin-top: 14px;
}

.notes-field .field-label {
  margin-top: 0;
}

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

.decision-footer {
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-700);
  font-size: 0.8rem;
}

.checkbox-label input {
  width: 17px;
  height: 17px;
  accent-color: var(--blue-600);
}

.button,
.icon-button {
  border-radius: var(--radius-sm);
  font-weight: 750;
}

.button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  font-size: 0.82rem;
}

.button-primary {
  color: var(--white);
  background: var(--blue-700);
}

.button-ghost {
  color: inherit;
  background: transparent;
  border-color: currentColor;
  opacity: 0.88;
}

.decision-section .button-ghost {
  color: var(--ink-700);
  border-color: var(--ink-200);
}

.icon-button {
  min-width: 34px;
  min-height: 32px;
  padding: 5px 8px;
  color: var(--ink-700);
  background: var(--white);
  border: 1px solid var(--ink-200);
  font-size: 0.76rem;
}

.queue-header {
  min-height: 72px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ink-200);
}

.queue-header strong {
  display: block;
  margin-top: 4px;
  font-size: 0.9rem;
}

.pager-actions {
  gap: 6px;
}

.queue-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.filter-panel,
.workbench,
.queue-list,
.raw-details {
  scrollbar-color: var(--ink-300) transparent;
  scrollbar-width: thin;
}

.filter-panel::-webkit-scrollbar,
.workbench::-webkit-scrollbar,
.queue-list::-webkit-scrollbar,
.raw-details::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.filter-panel::-webkit-scrollbar-thumb,
.workbench::-webkit-scrollbar-thumb,
.queue-list::-webkit-scrollbar-thumb,
.raw-details::-webkit-scrollbar-thumb {
  background: var(--ink-300);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

.queue-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 13px 14px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-100);
  text-align: left;
}

.queue-item:hover {
  background: var(--white);
}

.queue-item.active {
  background: var(--amber-100);
  box-shadow: inset 3px 0 var(--amber-400);
}

.queue-char {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--ink-950);
  background: var(--ink-100);
  border-radius: 9px;
  font-family: "Songti SC", SimSun, serif;
  font-size: 1.05rem;
  font-weight: 800;
}

.queue-copy {
  min-width: 0;
}

.queue-copy strong,
.queue-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-copy strong {
  font-size: 0.8rem;
}

.queue-copy span {
  margin-top: 4px;
  color: var(--ink-500);
  font-size: 0.72rem;
}

.queue-pinyin {
  padding-top: 2px;
  color: var(--blue-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 800;
}

.decision-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--ink-300);
}

.decision-dot.keep,
.decision-dot.change {
  background: var(--green-700);
}

.decision-dot.drop {
  background: var(--red-700);
}

.decision-dot.defer {
  background: var(--amber-600);
}

.queue-footer {
  min-height: 42px;
  padding: 12px 16px;
  color: var(--ink-500);
  border-top: 1px solid var(--ink-200);
  font-size: 0.75rem;
  text-align: center;
}

.empty-state,
.loading-state {
  max-width: 620px;
  margin: 13vh auto 0;
  padding: 48px;
  text-align: center;
}

.empty-glyph {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 16px;
  font-size: 1.7rem;
  font-weight: 800;
}

.empty-state h2 {
  margin: 0;
  font-size: 1.2rem;
}

.empty-state p {
  color: var(--ink-500);
  line-height: 1.6;
}

.skeleton {
  overflow: hidden;
  background: linear-gradient(90deg, var(--ink-100), #f7f9fa, var(--ink-100));
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.25s infinite linear;
}

.skeleton-line {
  height: 20px;
  margin-bottom: 28px;
}

.skeleton-line.short {
  width: 34%;
}

.skeleton-text {
  height: 90px;
  margin-bottom: 22px;
}

.skeleton-card {
  height: 190px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 12px 14px;
  color: var(--white);
  background: var(--ink-900);
  border-left: 4px solid var(--green-700);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  animation: toast-in 160ms ease-out;
}

.toast.error {
  border-left-color: #ef756b;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1120px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .review-layout {
    height: auto;
    min-height: calc(100vh - 76px);
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .queue-panel {
    display: none;
  }

  .filter-panel,
  .workbench {
    overflow: visible;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 70px;
    padding: 12px 15px;
  }

  .brand-block p,
  .connection-state {
    display: none;
  }

  .review-layout {
    display: block;
  }

  .filter-panel {
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--ink-200);
  }

  .filter-footnote {
    display: none;
  }

  .workbench {
    padding: 16px 12px 72px;
  }

  .sentence-section,
  .risk-section,
  .decision-section {
    padding: 20px 18px;
  }

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

  .decision-grid,
  .reviewer-row {
    grid-template-columns: 1fr;
  }

  .item-header {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
