:root {
  --annotation-green: #08721f;
  --annotation-bg: #003600;
  --annotation-line: rgba(245, 230, 211, 0.5);
}

.annotation-page {
  min-width: 900px;
  background: var(--annotation-bg);
}

.annotation-page .site-nav {
  background: #003600;
}

.annotation-page .site-nav__links {
  gap: clamp(20px, 2.4vw, 36px);
}

.annotation-workbench {
  width: min(1180px, calc(100% - 96px));
  margin: 28px auto 0;
  padding: 0 0 56px;
}

.annotation-toolbar {
  min-height: 68px;
  display: grid;
  grid-template-columns: 138px 138px minmax(300px, 1fr);
  align-items: start;
  gap: 16px;
}

.annotation-button,
.annotation-mode {
  min-height: 48px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: var(--annotation-green);
  color: var(--text-cream);
  font: inherit;
  font-size: 18px;
  font-weight: 600;
}

.annotation-button {
  padding: 7px 22px;
  cursor: pointer;
}

.annotation-file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.annotation-file-input {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.annotation-button:hover {
  background: #0a8424;
}

.annotation-button.is-active {
  background: #a33a32;
}

.annotation-mode {
  border-radius: 0;
  padding: 11px 18px;
  font-weight: 600;
  cursor: pointer;
  outline: 0;
}

.annotation-mode option {
  background: #075d18;
  color: var(--text-cream);
}

.annotation-layout {
  display: grid;
  grid-template-columns: 360px minmax(520px, 1fr);
  gap: 36px;
  align-items: start;
}

.image-stage {
  padding: 22px;
  border: 1px solid var(--annotation-line);
  border-radius: 6px;
  background: #cec6df;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.image-stage.has-warning {
  border-color: #ffdf59;
  box-shadow: 0 0 0 3px rgba(255, 223, 89, 0.32);
}

.image-stage.has-warning .annotation-hint {
  color: #fff3a8;
  font-weight: 700;
}

.annotation-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
  touch-action: none;
  user-select: none;
}

.annotation-canvas.is-drawing {
  cursor: crosshair;
}

.annotation-canvas.is-selecting {
  cursor: grab;
}

.annotation-canvas.is-selecting:active {
  cursor: grabbing;
}

.annotation-canvas img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border: 1px solid rgba(0, 54, 0, 0.18);
}

.annotation-boxes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.editor-canvas-host .annotation-boxes {
  pointer-events: auto;
}

.image-stage .annotation-boxes,
.image-stage .annotation-box--draft {
  display: none;
}

.annotation-box {
  position: absolute;
  border: 2px solid #ffdf59;
  background: rgba(255, 223, 89, 0.12);
}

.annotation-box:not(.annotation-box--draft) {
  pointer-events: auto;
  cursor: move;
}

.annotation-box.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px #08721f;
}

.annotation-box__label {
  position: absolute;
  top: -25px;
  left: -2px;
  max-width: 150px;
  padding: 2px 7px;
  overflow: hidden;
  border-radius: 3px 3px 0 0;
  background: #ffdf59;
  color: #003600;
  font-size: 13px;
  font-weight: 700;
  line-height: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.annotation-box--draft {
  z-index: 2;
  border-style: dashed;
  pointer-events: none;
}

.annotation-hint {
  margin: 14px 0 0;
  color: var(--text-cream);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  opacity: 0.86;
}

.category-panel {
  min-width: 0;
}

.category-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.category-heading-row h1 {
  width: 160px;
  margin: 0;
  padding: 8px 20px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: var(--annotation-green);
  text-align: center;
  font-size: 18px;
  line-height: 1.25;
}

.add-category {
  width: 160px;
}

.category-card {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--annotation-line);
  border-radius: 6px;
  cursor: pointer;
}

.category-card.is-selected {
  border-color: #ffdf59;
  box-shadow: inset 3px 0 0 #ffdf59;
}

.category-field {
  display: grid;
  grid-template-columns: 78px minmax(280px, 1fr) 52px;
  align-items: center;
  gap: 0;
  min-height: 68px;
}

.category-field label {
  padding-left: 4px;
  font-size: 18px;
  font-weight: 600;
}

.category-field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--annotation-line);
  border-radius: 0;
  outline: 0;
  background: var(--annotation-green);
  color: var(--text-cream);
  font: inherit;
  font-size: 18px;
}

.delete-category {
  align-self: stretch;
  border: 0;
  background: transparent;
  color: var(--text-cream);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.delete-category:hover {
  color: #ffb4ae;
}

@media (max-width: 1050px) {
  .annotation-workbench {
    width: calc(100% - 64px);
  }

  .annotation-layout {
    grid-template-columns: 320px minmax(460px, 1fr);
    gap: 24px;
  }
}

/* 标注编辑器 */
.annotation-editor {
  height: calc(100vh - 61px);
  min-height: 620px;
  background: #003600;
  color: var(--text-cream);
  overflow: hidden;
}

.editor-topbar {
  height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--annotation-line);
  background: #004400;
}

.editor-action {
  width: max-content;
  min-height: 36px;
  padding: 7px 15px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: #075d18;
  color: var(--text-cream);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.editor-action:hover {
  background: #08721f;
}

.editor-action--primary {
  border-color: #08721f;
  background: #08721f;
  color: #fff;
}

.editor-progress {
  display: flex;
  align-items: center;
  gap: 18px;
}

.editor-progress button {
  border: 0;
  background: transparent;
  color: rgba(245, 230, 211, 0.5);
  font-size: 24px;
}

.editor-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.editor-body {
  height: calc(100% - 122px);
  display: grid;
  grid-template-columns: 52px minmax(480px, 1fr) 260px;
}

.editor-tools {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 7px;
  border-right: 1px solid var(--annotation-line);
  background: #004400;
}

.editor-tool {
  position: relative;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-cream);
  font-size: 21px;
  cursor: pointer;
}

.editor-tool[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 44px;
  min-width: max-content;
  padding: 8px 12px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: #075d18;
  color: var(--text-cream);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translate(4px, -50%);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.editor-tool[data-tooltip]:hover::after,
.editor-tool[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.editor-tool:hover,
.editor-tool.is-active {
  background: #08721f;
  color: #fff;
}

.editor-tool-divider {
  width: 28px;
  border-top: 1px solid var(--annotation-line);
}

.editor-tool-spacer {
  flex: 1;
}

.editor-zoom-value {
  font-size: 11px;
}

.editor-canvas-host {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background: #063f18;
}

.editor-canvas-host .annotation-canvas {
  width: min(980px, 96%);
  max-height: calc(100% - 8px);
  box-shadow: 0 8px 28px rgba(24, 38, 45, 0.18);
  transform: scale(1.3);
  transform-origin: center;
}

.editor-sidebar {
  border-left: 1px solid var(--annotation-line);
  background: #004400;
  overflow-y: auto;
}

.editor-info-card,
.editor-label-card {
  padding: 17px;
  border-bottom: 1px solid var(--annotation-line);
}

.editor-sidebar h2 {
  margin: 0 0 14px;
  font-size: 15px;
}

.editor-info-card dl,
.editor-info-card dd {
  margin: 0;
}

.editor-info-card dl > div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px;
  margin-bottom: 9px;
  font-size: 13px;
}

.editor-info-card dt {
  color: rgba(245, 230, 211, 0.68);
}

.editor-info-card dd {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-section-title span {
  min-width: 25px;
  padding: 2px 7px;
  border-radius: 12px;
  background: #08721f;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.editor-label-list p {
  color: rgba(245, 230, 211, 0.68);
  font-size: 13px;
}

.editor-label-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--annotation-line);
  background: #075d18;
  font-size: 13px;
}

.editor-category-bar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px 0 72px;
  border-top: 1px solid var(--annotation-line);
  background: #004400;
}

.editor-category-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
}

.editor-manage-categories {
  flex: 0 0 auto;
  margin-left: auto;
}

.editor-category-chip {
  padding: 7px 14px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: #075d18;
  color: var(--text-cream);
  cursor: pointer;
}

.editor-category-chip.is-selected {
  border-color: #08721f;
  background: #08721f;
  color: #fff;
}

.annotation-stats-modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.annotation-stats-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 20, 0, 0.72);
}

.annotation-stats-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--annotation-line);
  border-radius: 8px;
  background: #004400;
  color: var(--text-cream);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.annotation-stats-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--annotation-line);
}

.annotation-stats-card h2,
.annotation-stats-card p {
  margin: 0;
}

.annotation-stats-card h2 {
  font-size: 21px;
}

.annotation-stats-card p {
  margin-top: 6px;
  font-size: 14px;
  opacity: 0.76;
}

.annotation-stats-close {
  border: 0;
  background: transparent;
  color: var(--text-cream);
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.annotation-stats-list {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.annotation-stats-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: #075d18;
}

.annotation-stats-empty {
  text-align: center;
  opacity: 0.72;
}

.annotation-stats-confirm {
  width: 100%;
}

.category-manager-card {
  width: min(520px, 100%);
}

.category-manager-create {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 10px;
  margin: 18px 0 12px;
}

.category-manager-create input,
.category-manager-name,
.category-manager-prompt {
  height: 42px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  outline: 0;
  background: #075d18;
  color: var(--text-cream);
  font: inherit;
  padding: 0 12px;
}

.category-manager-fields {
  display: grid;
  gap: 7px;
}

.category-manager-create input::placeholder {
  color: rgba(245, 230, 211, 0.62);
}

.category-manager-list {
  display: grid;
  gap: 9px;
  max-height: 300px;
  margin-bottom: 18px;
  overflow-y: auto;
}

.category-manager-row {
  display: grid;
  grid-template-columns: 14px 1fr 58px;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: #063f18;
}

.category-manager-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #ffdf59;
}

.category-manager-delete {
  border: 0;
  background: transparent;
  color: #ffb4ae;
  font: inherit;
  cursor: pointer;
}

.annotation-validation-card {
  width: min(380px, 100%);
}

.annotation-validation-card header {
  margin-bottom: 18px;
}

.annotation-validation-card #annotationValidationMessage {
  color: #fff3a8;
  font-size: 15px;
  opacity: 1;
}

.annotation-save-toast {
  position: fixed;
  z-index: 60;
  right: 24px;
  bottom: 24px;
  padding: 12px 18px;
  border: 1px solid var(--annotation-line);
  border-radius: 6px;
  background: #075d18;
  color: var(--text-cream);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  font-size: 14px;
}

.annotation-login-shell {
  width: min(480px, calc(100% - 40px));
  margin: 42px auto;
}

.annotation-login-card {
  padding: 24px;
  border: 1px solid var(--annotation-line);
  border-radius: 8px;
  background: #004400;
  color: var(--text-cream);
}

.annotation-login-card h1,
.annotation-login-card p {
  margin: 0;
}

.annotation-login-card h1 {
  font-size: 24px;
}

.annotation-login-card > p {
  margin: 8px 0 20px;
  opacity: 0.76;
}

.annotation-login-field {
  display: grid;
  gap: 8px;
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: 600;
}

.annotation-login-field input {
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  outline: 0;
  background: #003600;
  color: var(--text-cream);
  font: inherit;
}

.annotation-login-field input::placeholder {
  color: rgba(245, 230, 211, 0.62);
}

.annotation-login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.annotation-login-status {
  margin-top: 15px;
  font-size: 14px;
}

.annotation-login-status.is-error {
  color: #ffb4ae;
}

.annotation-login-status.is-success {
  color: #b9f6ca;
}

.annotation-hospital-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.annotation-hospital-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--annotation-line);
  border-radius: 5px;
  background: #063f18;
}

.annotation-hospital-item p {
  margin: 4px 0 0;
  font-size: 12px;
  opacity: 0.7;
}
