:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101111;
  color: #e8ecee;
  --topbar-height: 0px;
  --side-panel-width: 388px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  background: #101111;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

.app-frame {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--topbar-height) 14px 1fr;
  overflow: hidden;
}

.app-frame.topbar-collapsed {
  grid-template-rows: 0 14px 1fr;
}

.topbar {
  min-height: 0;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #343a3d;
  background: #202324;
  overflow: hidden;
}

.app-frame.topbar-collapsed .topbar {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.top-resizer {
  position: relative;
  z-index: 6;
  display: grid;
  place-items: center;
  min-height: 14px;
  background: #17191a;
  border-top: 1px solid #343a3d;
  border-bottom: 1px solid #343a3d;
  cursor: row-resize;
  user-select: none;
}

.top-resizer::before {
  content: "";
  width: 82px;
  height: 3px;
  border-radius: 999px;
  background: #3f474b;
}

.top-resizer:hover,
.top-resizer.is-dragging {
  background: #202527;
}

.top-resizer:hover::before,
.top-resizer.is-dragging::before {
  background: #5aa7ff;
}

.top-collapse-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 92px;
  height: 30px;
  min-height: 0;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid #40484b;
  border-radius: 16px;
  background: #242829;
  color: #d5dde1;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.26);
}

body.resizing-topbar {
  cursor: row-resize;
  user-select: none;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid #485257;
  border-radius: 8px;
  background: #2a2f31;
  color: #5aa7ff;
  font-weight: 600;
  letter-spacing: 0;
}

.brand-copy h1 {
  margin: 0;
  color: #f7f9fa;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
}

.brand-copy p {
  margin: 5px 0 0;
  color: #a7b2b8;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle,
.language-toggle {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #465156;
  border-radius: 7px;
  background: #171a1b;
  color: #dce3e6;
  cursor: pointer;
}

.language-toggle {
  grid-template-columns: 18px auto;
  gap: 4px;
  width: 58px;
  padding: 0 8px;
  color: #dce3e6;
  font-size: 12px;
  font-weight: 500;
}

.theme-toggle:hover,
.language-toggle:hover {
  border-color: #5aa7ff;
}

.language-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon {
  width: 21px;
  height: 21px;
  display: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun {
  display: block;
  color: #f5bf4f;
}

.theme-light .theme-icon-sun {
  display: none;
}

.theme-light .theme-icon-moon {
  display: block;
  color: #52626d;
}

.status {
  max-width: 360px;
  color: #c7d0d5;
  font-size: 13px;
  text-align: right;
}

.workspace {
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: var(--side-panel-width) 14px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  background: #101111;
}

.workspace.side-collapsed {
  grid-template-columns: 0 14px minmax(0, 1fr);
}

.side-panel,
.data-panel {
  min-height: 0;
  overflow: auto;
  background: #181a1a;
}

.side-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border: 1px solid #343a3d;
  border-radius: 8px;
  margin: 8px 0 8px 8px;
  padding: 10px;
  min-width: 0;
  gap: 10px;
}

.workspace.side-collapsed .side-panel {
  overflow: hidden;
  padding: 0;
  border-right: 0;
}

.data-panel {
  border: 1px solid #303638;
  border-radius: 8px;
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: #242625;
}

.data-panel[hidden] {
  display: none;
}

.panel-resizer {
  position: relative;
  z-index: 5;
  display: grid;
  place-items: center;
  min-width: 14px;
  background: #17191a;
  border-left: 1px solid #343a3d;
  border-right: 1px solid #343a3d;
  cursor: col-resize;
  user-select: none;
}

.panel-resizer-left {
  border-left: 0;
}

.panel-resizer::before {
  content: "";
  width: 3px;
  height: 68px;
  border-radius: 999px;
  background: #3f474b;
}

.workspace.side-collapsed .panel-resizer-left .collapse-handle {
  color: #ffffff;
}

.panel-resizer.is-dragging,
.panel-resizer:hover {
  background: #202527;
}

.panel-resizer.is-dragging::before,
.panel-resizer:hover::before {
  background: #5aa7ff;
}

.collapse-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 92px;
  min-height: 0;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 1px solid #40484b;
  border-radius: 18px;
  background: #242829;
  color: #d5dde1;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.26);
}

body.resizing-panel {
  cursor: col-resize;
  user-select: none;
}

.workflow-card,
.control-section,
.summary-panel {
  border: 1px solid #333839;
  border-radius: 8px;
  background: #242625;
}

.workflow-card,
.control-section {
  padding: 14px;
}

.control-stack {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.recognition-active .control-stack,
.recognition-complete .control-stack,
.recognition-active .summary-panel {
  display: none;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  color: #f3f6f7;
  font-size: 15px;
  font-weight: 500;
}

.ghost-button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px dashed #a95f2b;
  border-radius: 6px;
  background: rgba(169, 95, 43, 0.12);
  color: #f1a15c;
  font-size: 12px;
  font-weight: 500;
}

.steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.steps::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 17px;
  height: 2px;
  background: #3a3f40;
}

.steps span {
  position: relative;
  min-height: 74px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 6px;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  color: #cfd5d7;
  text-align: center;
  background: transparent;
}

.steps span::before {
  content: attr(data-step);
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 2px;
  border: 2px solid #4b5051;
  border-radius: 50%;
  background: #3d4142;
  color: #9ca4a7;
  font-size: 14px;
  font-weight: 500;
}

.workflow-step strong {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

.workflow-step small {
  min-height: 24px;
  color: #8a9194;
  font-size: 11px;
  line-height: 1.25;
}

.workflow-step.done::before {
  content: "✓";
  border-color: #1fa653;
  background: #1d6f3e;
  color: #bff4d4;
  font-size: 20px;
}

.workflow-step.done small {
  color: #36c36d;
}

.workflow-step.active::before {
  content: "...";
  border-color: #2e70e8;
  background: #374152;
  color: #79a8ff;
  font-size: 16px;
  box-shadow: 0 0 0 0 rgba(74, 156, 255, 0.42);
  animation: workflowPulse 1.5s ease-out infinite;
}

.workflow-step.active small,
.workflow-step.pending-accent small {
  color: #4e9df2;
}

.workflow-step.pending-accent strong {
  color: #5aa7ff;
}

.drop-zone {
  min-height: 56px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px dashed #5b6b72;
  border-radius: 8px;
  background: #1c1f20;
  color: #d4dcdf;
  cursor: pointer;
}

.drop-zone input {
  display: none;
}

.drop-zone:has(input:disabled) {
  cursor: wait;
  opacity: 0.62;
}

.run-button,
.icon-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: #2770c8;
  color: #ffffff;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.run-button {
  width: 100%;
  margin-top: 10px;
}

.icon-button[href="#"] {
  pointer-events: none;
  opacity: 0.45;
}

.icon-button.subtle {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #3d474b;
  background: #1b1f20;
  color: #cdd7dc;
  font-size: 12px;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.history-section {
  display: grid;
  gap: 10px;
}

.history-list {
  display: grid;
  gap: 7px;
}

.history-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid #343c3f;
  border-radius: 6px;
  background: #1c2021;
  color: #dce5e8;
  text-align: left;
  cursor: pointer;
}

.history-item strong,
.history-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  font-size: 13px;
  font-weight: 500;
}

.history-item span {
  grid-column: 1 / -1;
  color: #93a0a7;
  font-size: 12px;
}

.history-item em {
  padding: 2px 7px;
  border-radius: 999px;
  background: #26313a;
  color: #80bfff;
  font-size: 11px;
  font-style: normal;
}

.history-item em[data-status="done"] {
  background: rgba(28, 133, 72, 0.2);
  color: #55d987;
}

.history-item em[data-status="failed"] {
  background: rgba(176, 45, 45, 0.22);
  color: #ff7777;
}

.history-empty {
  margin: 0;
  color: #8f9ca2;
  font-size: 13px;
}

.field-grid label {
  display: grid;
  gap: 6px;
  color: #aeb8bd;
  font-size: 12px;
  font-weight: 500;
}

select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #465156;
  border-radius: 6px;
  padding: 0 10px;
  background: #171a1b;
  color: #f2f5f6;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.toggle-grid label,
.check-control {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd4d8;
  font-size: 12px;
  font-weight: 500;
}

.overlay-control {
  display: none;
}

.show-overlay-controls .overlay-control {
  display: flex;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: 12px;
  overflow: hidden;
}

.summary-panel[hidden] {
  display: none;
}

.summary-panel div {
  padding: 12px;
  border-right: 1px solid #383f42;
  border-bottom: 1px solid #383f42;
}

.summary-panel strong {
  display: block;
  color: #f7f9fa;
  font-size: 20px;
}

.summary-panel span {
  color: #9fa9ae;
  font-size: 12px;
  font-weight: 500;
}

.canvas-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  display: grid;
  grid-template-rows: 42px 38px 1fr;
  background: #666b69;
  overflow: hidden;
  border: 1px solid #343a3d;
  border-radius: 8px;
  margin: 8px 8px 8px 0;
}

.drawing-header {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid #303637;
  background: linear-gradient(#2f3130, #222423);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.drawing-file {
  min-width: 0;
  color: #cfd6d8;
  font-size: 16px;
  font-weight: 400;
}

.drawing-file strong {
  color: #e6ebed;
  font-weight: 400;
}

.drawing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  background: rgba(45, 177, 91, 0.18);
  color: #68d58c;
  font-size: 12px;
  font-weight: 500;
}

.save-status::before {
  content: "✓";
  margin-right: 4px;
}

.save-status.saving {
  background: rgba(47, 124, 255, 0.18);
  color: #74b3ff;
}

.save-status.saving::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid rgba(116, 179, 255, 0.3);
  border-top-color: #74b3ff;
  border-radius: 999px;
  animation: spin 820ms linear infinite;
}

.save-status.failed {
  background: rgba(224, 67, 54, 0.18);
  color: #ff8a80;
  cursor: pointer;
}

.save-status.failed::before {
  content: "!";
}

.pill-button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border: 1px solid #d4d8da;
  border-radius: 14px;
  background: #f4f5f5;
  color: #202323;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.local-library {
  cursor: pointer;
}

.canvas-toolbar {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid #555958;
  background: linear-gradient(#767a79, #646867);
  align-self: stretch;
}

.segmented,
.zoom-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid #3f484c;
  border-radius: 7px;
  overflow: hidden;
  background: #2b3032;
}

.segmented button,
.zoom-control button {
  min-height: 28px;
  border: 0;
  border-right: 1px solid #3f484c;
  padding: 0 10px;
  background: transparent;
  color: #dce3e6;
  font-weight: 500;
  cursor: pointer;
}

.segmented button:last-child,
.zoom-control button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #2e7bd4;
  color: #ffffff;
}

.zoom-control span {
  min-width: 52px;
  text-align: center;
  color: #f3f6f7;
  font-size: 13px;
  font-weight: 500;
}

.bubble-controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 30px;
  padding: 2px;
  border-radius: 7px;
  background: rgba(128, 128, 128, 0.18);
}

.bubble-control-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.18);
}

.bubble-size-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 0;
  border-radius: 5px;
  overflow: hidden;
  background: transparent;
}

.bubble-size-control .bubble-size-btn {
  min-height: 26px;
  min-width: 26px;
  border: 0;
  border-radius: 4px;
  padding: 0 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.bubble-size-control .bubble-size-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
}

.bubble-size-control .bubble-size-btn:disabled {
  color: rgba(255, 255, 255, 0.32);
  cursor: default;
}

.bubble-size-control .bubble-size-btn:disabled:hover {
  background: transparent;
}

.bubble-size-control span {
  min-width: 48px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #f3f6f7;
  font-size: 13px;
  font-weight: 500;
}

.tool-icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.tool-icon-button:disabled {
  cursor: default;
}

.tool-icon-button svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.canvas-history-controls {
  position: absolute;
  top: 98px;
  left: 14px;
  z-index: 18;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.show-overlay-controls .canvas-history-controls {
  display: flex;
}

.history-icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  padding: 0;
  background: #f4f5f5;
  color: #3b3f40;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  pointer-events: auto;
}

.history-icon-button:disabled {
  border-color: rgba(255, 255, 255, 0.18);
  background: #929695;
  color: rgba(47, 51, 52, 0.62);
  box-shadow: none;
  cursor: default;
}

.history-icon-button svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.manual-annotation-button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 0 8px;
  background: rgba(43, 48, 51, 0.82);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.manual-annotation-button:hover {
  background: rgba(54, 61, 65, 0.92);
  color: #ffffff;
}

.manual-annotation-button.active {
  border-color: rgba(47, 124, 255, 0.8);
  background: #2f7cff;
  color: #ffffff;
}

.manual-annotation-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.manual-annotation-button svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.export-menu {
  position: relative;
  display: none;
  align-items: center;
}

.recognition-complete .export-menu {
  display: inline-flex;
}

.export-bubble-button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  padding: 0 10px;
  background: #f26a22;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.export-bubble-button:hover {
  background: #ff7a2f;
}

.export-bubble-button svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.export-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 104px;
  padding: 5px;
  border: 1px solid #3f484c;
  border-radius: 7px;
  background: #24292b;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
}

.export-options button {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  padding: 0 10px;
  background: transparent;
  color: #e7ecef;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.export-options button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.theme-light .export-options {
  border-color: rgba(36, 44, 48, 0.16);
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(22, 28, 31, 0.18);
}

.theme-light .export-options button {
  color: #1f262a;
}

.theme-light .export-options button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.theme-light .export-bubble-button {
  border-color: rgba(183, 82, 25, 0.24);
  background: #f26a22;
  color: #ffffff;
  box-shadow: 0 7px 16px rgba(85, 47, 20, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.theme-light .export-bubble-button:hover {
  background: #ff7a2f;
}

.toolbar-divider {
  width: 1px;
  height: 28px;
  background: #40484b;
}

.idle-state {
  align-self: stretch;
  justify-self: stretch;
  max-width: none;
  min-height: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: #f1f5f6;
  text-align: center;
  grid-row: 3;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #666b69;
  background-size: 42px 42px;
}

.idle-state strong {
  font-size: 18px;
  font-weight: 500;
}

.idle-state span {
  color: #d0d7da;
  font-size: 13px;
}

.idle-state[hidden] {
  display: none;
}

.canvas-panel.processing-canvas .result,
.canvas-panel.processing-canvas .idle-state {
  filter: blur(4px) grayscale(0.15);
  opacity: 0.42;
  transition: filter 160ms ease, opacity 160ms ease;
}

.result {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 16px 22px 28px;
}

.result[hidden] {
  display: none;
}

.preview-list {
  display: grid;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.preview-item {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: 100%;
  min-height: 0;
}

.preview-item h2 {
  display: none;
}

.drawing-figure {
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  max-height: none;
  display: block;
  border: 0;
  border-radius: 0;
  background: #686b6a;
  cursor: default;
  overscroll-behavior: contain;
}

.drawing-figure.can-pan,
.canvas-space-down .drawing-figure {
  cursor: grab;
}

.drawing-figure.is-panning {
  cursor: grabbing;
}

.manual-select-ready .drawing-figure,
.manual-selecting .drawing-figure {
  cursor: crosshair !important;
}

.manual-select-ready .drawing-figure::after {
  content: "拖框新增标注";
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 12;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 5px;
  background: rgba(29, 32, 33, 0.82);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.drawing-stage {
  position: relative;
  width: calc(100% * var(--zoom, 1));
  min-width: 1px;
  transform: rotate(var(--rotation, 0deg));
  transform-origin: center center;
  transition: transform 140ms ease;
}

.drawing-figure img {
  width: 100%;
  height: auto;
  display: block;
  background: #ffffff;
  box-shadow: 0 0 0 1px #b8bebe, 0 12px 34px rgba(0, 0, 0, 0.36);
}

.bubble-callout {
  position: absolute;
  z-index: 3;
  width: calc(48px * var(--bubble-scale, 1));
  height: calc(48px * var(--bubble-scale, 1));
  pointer-events: auto;
  cursor: context-menu;
}

.bubble-callout.is-dragging {
  cursor: grabbing;
  z-index: 10;
  opacity: 0.85;
}

.bubble-callout.is-dragging .bubble-pin {
  transform: scale(1.12);
  filter: drop-shadow(0 4px 12px rgba(217, 39, 39, 0.55));
}

/* Circular bubble style */
.bubble-callout.bubble-style-circle {
  /* width/height already 48px from .bubble-callout */
}

.bubble-callout.bubble-style-circle .bubble-pin circle {
  stroke-width: 2.5;
}

.bubble-callout.bubble-style-circle .bubble-pin text {
  fill: #d92727;
  font-size: 18px;
  font-weight: 600;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

/* Leader line SVG — positioned absolutely inside .drawing-stage */
.bubble-leader-svg {
  pointer-events: none;
}

/* Bubble style toggle buttons */
.bubble-style-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: transparent;
  border-radius: 5px;
  padding: 0;
}

.bubble-style-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  padding: 0;
  transition: background 120ms, color 120ms;
}

.bubble-style-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.bubble-style-btn.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.theme-light .bubble-style-btn {
  color: rgba(0, 0, 0, 0.45);
}

.theme-light .bubble-style-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.9);
}

.theme-light .bubble-style-btn.active {
  background: rgba(0, 0, 0, 0.12);
  color: #000;
}

.dimension-highlight {
  position: absolute;
  z-index: 2;
  display: block;
  border: 0;
  outline: 1px solid rgba(21, 181, 99, 0.9);
  outline-offset: 0;
  background: rgba(67, 224, 137, 0.13);
  pointer-events: auto;
  cursor: context-menu;
  transition: background 120ms ease, box-shadow 120ms ease, outline-color 120ms ease;
}

.dimension-highlight:hover,
.dimension-highlight.selected-highlight {
  outline-color: rgba(47, 124, 255, 0.98);
  background: rgba(47, 124, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(47, 124, 255, 0.68), 0 0 10px rgba(47, 124, 255, 0.24);
}

.dimension-highlight.is-resizing-box {
  outline: 2px solid rgba(47, 124, 255, 0.98);
  background: rgba(47, 124, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 14px rgba(47, 124, 255, 0.3);
  z-index: 6;
}

.dimension-highlight.is-resize-dragging {
  cursor: grabbing;
}

.annotation-resize-handle {
  position: absolute;
  z-index: 7;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 2px;
  background: #2f7cff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.32);
  pointer-events: auto;
}

.annotation-resize-handle.handle-nw {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}

.annotation-resize-handle.handle-n {
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.annotation-resize-handle.handle-ne {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}

.annotation-resize-handle.handle-e {
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.annotation-resize-handle.handle-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.annotation-resize-handle.handle-s {
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.annotation-resize-handle.handle-sw {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}

.annotation-resize-handle.handle-w {
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.manual-selection-rect {
  position: absolute;
  z-index: 8;
  display: block;
  border: 1px solid rgba(47, 124, 255, 0.95);
  background: rgba(47, 124, 255, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.32) inset;
  pointer-events: none;
}

.manual-region-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 9;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(29, 32, 33, 0.88);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.26);
}

.manual-region-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-top-color: #58a6ff;
  border-radius: 999px;
  animation: spin 820ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hide-bubbles .bubble-callout,
.hide-bubbles .bubble-leader-svg {
  display: none;
}

.hide-borders .dimension-highlight {
  display: none;
}

.bubble-pin {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(25, 31, 35, 0.26));
  transition: transform 120ms ease, filter 120ms ease;
}

.selected-bubble .bubble-pin,
.bubble-callout:hover .bubble-pin {
  transform: scale(1.08);
  filter: drop-shadow(0 2px 8px rgba(217, 39, 39, 0.45));
}

.bubble-pin text {
  fill: #d92727;
  font-size: 18px;
  font-weight: 600;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.preview-item a {
  display: none;
}

.preview-diagnostics {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(760px, calc(100% - 28px));
  pointer-events: none;
}

.preview-diagnostics span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(22, 26, 28, 0.82);
  color: #e6edf0;
  font-size: 12px;
  line-height: 1.25;
}

.processing-placeholder {
  min-height: 420px;
  display: grid;
  place-items: center;
  border: 1px dashed #9aa4a9;
  border-radius: 4px;
  background: #f7f8f8;
  color: #344046;
  text-align: center;
}

.processing-placeholder strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

.processing-overlay[hidden] {
  display: none;
}

.processing-dialog {
  width: min(680px, 46vw);
  border: 1px solid #455158;
  border-radius: 8px;
  padding: 20px 22px;
  background: rgba(29, 31, 31, 0.95);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  color: #eef4f6;
}

.processing-head {
  display: grid;
  gap: 6px;
}

.processing-kicker {
  display: none;
  font-size: 12px;
  font-weight: 500;
}

.processing-head strong {
  font-size: 17px;
}

.processing-head p {
  margin: 0;
  color: #b7c2c8;
  font-size: 13px;
}

.processing-eta {
  min-height: 18px;
  color: #8edfec;
  font-size: 12px;
}

.progress-track {
  height: 10px;
  margin: 14px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.06) 50%, rgba(255, 255, 255, 0.06) 75%, transparent 75%),
    #111516;
  background-size: 28px 28px;
  animation: progressTrackFlow 1.1s linear infinite;
}

.progress-value {
  width: 0%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #20b8ce, #38d3e7 48%, #72f2ff);
  transition: width 420ms ease;
}

.progress-value::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, transparent 0%, transparent 34%, rgba(255, 255, 255, 0.55) 50%, transparent 66%, transparent 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 8px, transparent 8px 16px);
  transform: translateX(-100%);
  animation: progressValueSweep 1.25s linear infinite;
}

@keyframes progressTrackFlow {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 28px 0;
  }
}

@keyframes progressValueSweep {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes workflowPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 156, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(74, 156, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 156, 255, 0);
  }
}

.processing-steps {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.processing-steps li {
  min-width: 0;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 10px 6px;
  border: 1px solid #3c464b;
  border-radius: 7px;
  color: #8f9aa0;
  background: #24292b;
  text-align: center;
}

.processing-steps span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #343c40;
  color: #c9d2d6;
  font-size: 12px;
  font-weight: 500;
}

.processing-steps strong {
  font-size: 12px;
}

.processing-steps li.done {
  border-color: rgba(84, 215, 139, 0.65);
  color: #d7f8e5;
}

.processing-steps li.done span {
  background: #268b54;
  color: #ffffff;
}

.processing-steps li.active {
  border-color: #4a9cff;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(74, 156, 255, 0.25);
}

.processing-steps li.active span {
  background: #2e7bd4;
  color: #ffffff;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #343a3d;
  background: #202324;
}

.tab-button {
  min-height: 46px;
  border: 0;
  border-right: 1px solid #343a3d;
  background: transparent;
  color: #aeb8bd;
  font-weight: 500;
  cursor: pointer;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button.active {
  color: #ffffff;
  background: #2a2f31;
  box-shadow: inset 0 -2px 0 #4a9cff;
}

.tab-page {
  display: none;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.tab-page.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
}

.annotation-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: #f0f3f4;
}

.annotation-toolbar strong {
  font-size: 16px;
  font-weight: 500;
}

.annotation-toolbar span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  background: #233f72;
  color: #7fb0ff;
  font-size: 12px;
  font-weight: 500;
}

.table-shell {
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #242625;
}

.gdt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  line-height: 1.35;
}

.gdt-table th,
.gdt-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #343a3d;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.gdt-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #242625;
  color: #c5d0d5;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.gdt-table td {
  color: #e1e7ea;
  font-weight: 400;
}

.gdt-table td:first-child {
  color: #55aaff;
  text-align: center;
  font-weight: 400;
}

.gdt-table th:nth-child(1),
.gdt-table td:nth-child(1) {
  width: 42px;
}

.gdt-table th:nth-child(2),
.gdt-table td:nth-child(2) {
  width: 30%;
}

.gdt-table th:nth-child(3),
.gdt-table td:nth-child(3),
.gdt-table th:nth-child(4),
.gdt-table td:nth-child(4) {
  width: 48px;
}

.gdt-table th:nth-child(5),
.gdt-table td:nth-child(5) {
  width: 50px;
}

.gdt-table td:nth-child(3) {
  color: #35bf6d;
}

.gdt-table td:nth-child(4) {
  color: #e34a4a;
}

.gdt-table td:nth-child(5) {
  color: #e6eaea;
  font-weight: 500;
}

.gdt-table th:last-child,
.gdt-table td.adjust-cell {
  width: 34px;
  text-align: center;
}

.adjust-cell {
  min-width: 34px;
  padding-left: 2px;
  padding-right: 2px;
  white-space: nowrap;
}

.adjust-order-button {
  width: 14px;
  height: 20px;
  min-height: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #2f7cff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.adjust-order-button:hover:not(:disabled) {
  background: rgba(47, 124, 255, 0.16);
  color: #6fa7ff;
}

.adjust-order-button:disabled {
  color: #7a8387;
  cursor: default;
  opacity: 0.45;
}

.gdt-table tbody tr {
  cursor: default;
}

.gdt-table tbody tr:hover td {
  background: rgba(74, 156, 255, 0.12);
}

.gdt-table tr.selected-row td {
  background: rgba(74, 156, 255, 0.2);
  color: #ffffff;
}

.gdt-table tr.selected-row td:first-child {
  color: #7dbbff;
  font-weight: 500;
}

.gdt-table tr:last-child td {
  border-bottom: 0;
}

.candidate-selected td:first-child {
  color: #49d28a;
  font-weight: 500;
}

.annotation-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding-top: 4px;
  border-top: 1px solid #343a3d;
  color: #8d9497;
  font-size: 13px;
}

.candidate-rejected td {
  color: #8f9aa0;
}

.ocr-raw-list {
  display: grid;
  gap: 8px;
}

.ocr-raw-list details {
  border: 1px solid #383f42;
  border-radius: 8px;
  background: #25292b;
}

.ocr-raw-list summary {
  padding: 10px 12px;
  color: #f2f5f6;
  font-weight: 500;
  cursor: pointer;
}

.ocr-raw-list ol {
  max-height: none;
  margin: 0;
  padding: 0 16px 14px 34px;
  overflow: auto;
  color: #cbd4d8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.feedback-panel {
  display: grid;
  gap: 12px;
  margin: 16px 8px 8px;
  padding: 14px;
  border: 1px solid #343b3e;
  border-radius: 8px;
  background: #202426;
}

.feedback-copy {
  display: grid;
  gap: 4px;
}

.feedback-copy strong {
  color: #f2f5f6;
  font-size: 16px;
  font-weight: 600;
}

.feedback-copy span,
.feedback-status {
  color: #9da8ad;
  font-size: 13px;
}

.feedback-form {
  display: grid;
  gap: 10px;
}

.feedback-rating,
.feedback-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.feedback-rating label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d8dee2;
  font-size: 13px;
}

.feedback-form textarea,
.feedback-form input[type="text"] {
  width: 100%;
  border: 1px solid #3c464a;
  border-radius: 6px;
  background: #111719;
  color: #eef3f5;
  font: inherit;
  font-size: 13px;
  padding: 9px 10px;
}

.feedback-form textarea {
  resize: vertical;
  min-height: 72px;
}

.feedback-actions input[type="text"] {
  flex: 1 1 220px;
}

.feedback-status.success {
  color: #4fc47a;
}

.feedback-status.error {
  color: #ff6b6b;
}

body.theme-light {
  color-scheme: light;
  background: #eef2f5;
  color: #1f2a30;
}

.theme-light .topbar,
.theme-light .side-panel,
.theme-light .data-panel,
.theme-light .tabs {
  background: #ffffff;
}

.theme-light .topbar {
  border-bottom-color: #d6dee4;
  box-shadow: 0 1px 0 rgba(21, 35, 46, 0.04);
}

.theme-light .brand-mark {
  border-color: #cfd9e1;
  background: #edf4ff;
  color: #1d6fd1;
}

.theme-light .brand-copy h1,
.theme-light .section-head h2,
.theme-light .summary-panel strong,
.theme-light .preview-item h2,
.theme-light .ocr-raw-list summary {
  color: #1f2a30;
}

.theme-light .brand-copy p,
.theme-light .status,
.theme-light .field-grid label,
.theme-light .summary-panel span,
.theme-light .idle-state span,
.theme-light .tab-button,
.theme-light .candidate-rejected td {
  color: #62707a;
}

.theme-light .top-resizer,
.theme-light .panel-resizer {
  background: #e4ebf0;
  border-color: #cfd9e1;
}

.theme-light .top-resizer::before,
.theme-light .panel-resizer::before {
  background: #aab8c2;
}

.theme-light .top-resizer:hover,
.theme-light .top-resizer.is-dragging,
.theme-light .panel-resizer:hover,
.theme-light .panel-resizer.is-dragging {
  background: #d7e8fb;
}

.theme-light .top-resizer:hover::before,
.theme-light .top-resizer.is-dragging::before,
.theme-light .panel-resizer:hover::before,
.theme-light .panel-resizer.is-dragging::before {
  background: #2e7bd4;
}

.theme-light .top-collapse-handle,
.theme-light .collapse-handle {
  border-color: #c6d2dc;
  background: #ffffff;
  color: #52626d;
  box-shadow: 0 5px 18px rgba(31, 42, 48, 0.16);
}

.theme-light .workflow-card,
.theme-light .control-section,
.theme-light .summary-panel,
.theme-light .ocr-raw-list details,
.theme-light .table-shell {
  border-color: #d7e0e6;
  background: #ffffff;
}

.theme-light .steps span,
.theme-light .drop-zone {
  border-color: #d7e0e6;
  background: #f7fafc;
  color: #43515b;
}

.theme-light .steps span::before {
  background: #e5f0ff;
  color: #1d6fd1;
}

.theme-light .ghost-button {
  border-color: #df8c43;
  background: #fff6ed;
  color: #b95d13;
}

.theme-light select {
  border-color: #c9d5de;
  background: #ffffff;
  color: #1f2a30;
}

.theme-light .toggle-grid label,
.theme-light .check-control {
  color: #52626d;
}

.theme-light .summary-panel div,
.theme-light .tabs,
.theme-light .tab-button,
.theme-light .gdt-table th,
.theme-light .gdt-table td,
.theme-light .data-panel,
.theme-light .side-panel {
  border-color: #d7e0e6;
}

.theme-light .canvas-panel {
  background: #d7dde2;
}

.theme-light .canvas-toolbar {
  border-bottom-color: #c4ced6;
  background: linear-gradient(#f5f7f9, #e4e9ed);
}

.theme-light .segmented,
.theme-light .zoom-control,
.theme-light .theme-toggle,
.theme-light .language-toggle {
  border-color: #c9d5de;
  background: #ffffff;
  color: #46545f;
}

.theme-light .segmented button,
.theme-light .zoom-control button {
  border-right-color: #c9d5de;
  color: #46545f;
}

.theme-light .segmented button.active {
  background: #2e7bd4;
  color: #ffffff;
}

.theme-light .zoom-control span,
.theme-light .idle-state {
  color: #1f2a30;
}

.theme-light .bubble-controls {
  background: rgba(0, 0, 0, 0.08);
}

.theme-light .bubble-control-divider {
  background: rgba(0, 0, 0, 0.16);
}

.theme-light .bubble-size-control .bubble-size-btn {
  color: rgba(0, 0, 0, 0.55);
}

.theme-light .bubble-size-control .bubble-size-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.9);
}

.theme-light .bubble-size-control span {
  color: rgba(0, 0, 0, 0.78);
}

.theme-light .manual-annotation-button {
  border-color: #c9d5de;
  background: #ffffff;
  color: #46545f;
}

.theme-light .manual-annotation-button:hover {
  background: #eef3f6;
  color: #1f2a30;
}

.theme-light .manual-annotation-button.active {
  border-color: #2e7bd4;
  background: #2e7bd4;
  color: #ffffff;
}

.theme-light .toolbar-divider {
  background: #c9d5de;
}

.theme-light .drawing-figure {
  border-color: #c8d3db;
  background: #ffffff;
}

.theme-light.manual-select-ready .drawing-figure::after {
  border-color: rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(31, 42, 48, 0.92);
}

.theme-light .preview-item a {
  color: #1d6fd1;
}

.theme-light .processing-dialog {
  border-color: #c7d4dd;
  background: rgba(255, 255, 255, 0.96);
  color: #1f2a30;
  box-shadow: 0 24px 70px rgba(31, 42, 48, 0.22);
}

.theme-light .processing-kicker {
  color: #1d6fd1;
}

.theme-light .processing-head p {
  color: #62707a;
}

.theme-light .processing-eta {
  color: #168399;
}

.theme-light .progress-track {
  background: #e2e9ee;
}

.theme-light .processing-steps li {
  border-color: #d7e0e6;
  background: #f7fafc;
  color: #687782;
}

.theme-light .processing-steps span {
  background: #e5edf3;
  color: #52626d;
}

.theme-light .processing-steps li.done {
  border-color: rgba(34, 150, 89, 0.45);
  color: #187345;
}

.theme-light .processing-steps li.active {
  border-color: #2e7bd4;
  color: #1f2a30;
}

.theme-light .tab-button.active {
  color: #1f2a30;
  background: #eef4fa;
}

.theme-light .gdt-table th {
  background: #f3f7fa;
  color: #52626d;
}

.theme-light .gdt-table td {
  color: #26343c;
}

.theme-light .gdt-table tbody tr:hover td {
  background: rgba(46, 123, 212, 0.1);
}

.theme-light .gdt-table tr.selected-row td {
  background: rgba(46, 123, 212, 0.16);
  color: #102538;
}

.theme-light .gdt-table tr.selected-row td:first-child {
  color: #1d6fd1;
}

.theme-light .candidate-selected td:first-child {
  color: #13804b;
}

.theme-light .ocr-raw-list ol {
  color: #52626d;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: var(--side-panel-width) 14px minmax(0, 1fr);
  }

  .workspace.side-collapsed .side-panel {
    display: none;
  }

  .data-panel {
    border-left: 0;
  }

}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: auto 1fr;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .workspace {
    grid-template-columns: minmax(260px, 44vw) 14px minmax(0, 1fr);
  }

  .side-panel {
    margin: 6px 0 6px 6px;
    padding: 8px;
  }

  .canvas-panel {
    min-height: 0;
    margin: 6px 6px 6px 0;
  }

  .canvas-toolbar {
    flex-wrap: wrap;
  }

  .drawing-actions {
    display: none;
  }

  .steps span {
    min-height: 76px;
  }

  .workflow-step strong,
  .workflow-step small,
  .gdt-table {
    font-size: 11px;
  }
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-dialog {
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #3a3a3a);
  border-radius: 10px;
  min-width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.candidate-dialog {
  width: min(520px, calc(100vw - 32px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color, #3a3a3a);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted, #888);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-color, #e0e0e0);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.manual-entry-hint {
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #3b464b;
  border-radius: 6px;
  background: rgba(47, 124, 255, 0.1);
  color: #cdd8de;
  font-size: 13px;
  line-height: 1.45;
}

.candidate-hint {
  margin: 0;
  color: var(--text-muted, #9aa4a9);
  font-size: 13px;
  line-height: 1.5;
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.candidate-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-color, #3a3a3a);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.candidate-item:hover {
  border-color: rgba(74, 158, 255, 0.72);
  background: rgba(74, 158, 255, 0.1);
}

.candidate-text {
  min-width: 0;
  color: var(--text-color, #e0e0e0);
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-category {
  color: var(--text-muted, #9aa4a9);
  font-size: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-group {
  display: flex;
  gap: 14px;
}

.form-row-group .form-row {
  flex: 1;
}

.form-row label {
  font-size: 12px;
  color: var(--text-muted, #888);
}

.form-row input,
.form-row select {
  padding: 8px 12px;
  border: 1px solid var(--border-color, #3a3a3a);
  border-radius: 6px;
  background: var(--bg-primary, #252526);
  color: var(--text-color, #e0e0e0);
  font-size: 14px;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent-color, #4a9eff);
}

.form-row input[readonly] {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color, #3a3a3a);
}

/* Row Tooltip */
.row-tooltip {
  position: fixed;
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #3a3a3a);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  max-width: 300px;
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  line-height: 1.5;
}

.row-tooltip[hidden] {
  display: none !important;
}

.row-tooltip .tooltip-row {
  display: flex;
  gap: 8px;
}

.row-tooltip .tooltip-label {
  color: var(--text-muted, #888);
  white-space: nowrap;
}

.row-tooltip .tooltip-value {
  color: var(--text-color, #e0e0e0);
  word-break: break-all;
}

/* Table row hover */
.gdt-table tbody tr {
  cursor: default;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #3a3a3a);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 140px;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.context-menu[hidden] {
  display: none !important;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-color, #e0e0e0);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.context-menu-item:hover {
  background: var(--bg-hover, #2a2a2a);
}

.context-menu-item.danger {
  color: #e53935;
}

.context-menu-item.danger:hover {
  background: rgba(229, 57, 53, 0.15);
}

.context-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.context-menu-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
