:root {
  --bg: #f5efe4;
  --bg-strong: #ecdfcb;
  --panel: rgba(255, 252, 245, 0.82);
  --panel-border: rgba(74, 53, 29, 0.14);
  --text: #1f1a16;
  --muted: #6d5d4d;
  --accent: #096b68;
  --accent-strong: #084b4a;
  --accent-soft: rgba(9, 107, 104, 0.11);
  --highlight: #d86f45;
  --danger: #b4432b;
  --danger-soft: rgba(180, 67, 43, 0.12);
  --shadow: 0 18px 50px rgba(52, 33, 13, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-btn: 11px;
  --btn-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 10px 22px rgba(52, 33, 13, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216, 111, 69, 0.16), transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(9, 107, 104, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f3ea 0%, #f2e7d5 100%);
}

.hero h1,
.results-header h2,
.panel > h2,
.empty-state h3 {
  font-family: "Songti SC", "STSong", "SimSun", "PingFang SC", "Microsoft YaHei", serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  filter: blur(16px);
  opacity: 0.75;
}

body::before {
  top: 56px;
  right: 5%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(216, 111, 69, 0.18);
}

body::after {
  bottom: 30px;
  left: 4%;
  width: 240px;
  height: 240px;
  border-radius: 34% 66% 52% 48%;
  background: rgba(9, 107, 104, 0.18);
}

.page {
  width: min(1400px, calc(100vw - 32px));
  margin: 24px auto 40px;
}

.top-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.76);
  box-shadow: 0 12px 34px rgba(52, 33, 13, 0.1);
  backdrop-filter: blur(14px);
}

.tab-button {
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: none;
}

.tab-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.55);
  transform: none;
}

.tab-button.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 10px 22px rgba(9, 107, 104, 0.2);
}

.tab-button.is-active:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.page-view {
  display: none;
}

.page-view.is-active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.hero-card,
.stat-card,
.panel,
.result-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(9, 107, 104, 0.18), transparent 72%);
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4.4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero p {
  margin: 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.65;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.stat-card {
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 172px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 10px;
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stat-note {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 22px;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 1.18rem;
}

.panel-subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.hint {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--muted);
}

.option-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(90, 70, 46, 0.08);
  font-weight: 700;
}

.option-toggle input,
.option-toggle select {
  width: auto;
  accent-color: var(--accent);
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgb(128, 0, 128);
  border: 1px solid rgba(31, 26, 22, 0.18);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.color-picker-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.46);
  border: 1px dashed rgba(90, 70, 46, 0.14);
}

.color-picker-controls input[type="color"] {
  width: 42px;
  height: 32px;
  padding: 2px;
}

.edge-cleanup-stack {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.46);
  border: 1px dashed rgba(90, 70, 46, 0.14);
}

.edge-cleanup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.edge-cleanup-row .btn-xs {
  padding: 2px 10px;
  font-size: 0.8em;
  min-width: 48px;
  min-height: 28px;
}

.edge-cleanup-row input[type="range"] {
  width: 170px;
  padding: 0;
}

.prompt-field {
  display: grid;
  gap: 8px;
}

.prompt-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-field-head label {
  display: block;
}

.prompt-menu-wrap {
  position: relative;
}

.prompt-menu-trigger {
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.prompt-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  width: min(320px, calc(100vw - 48px));
  padding: 8px;
  border: 1px solid rgba(90, 70, 46, 0.12);
  border-radius: 18px;
  background: rgba(255, 252, 245, 0.98);
  box-shadow: 0 18px 48px rgba(52, 33, 13, 0.18);
}

.prompt-menu[hidden] {
  display: none;
}

.prompt-menu button {
  width: 100%;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 800;
}

.prompt-menu button:hover {
  background: var(--accent-soft);
}

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

input,
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(90, 70, 46, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(9, 107, 104, 0.55);
  box-shadow: 0 0 0 4px rgba(9, 107, 104, 0.12);
}

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

/* 文件选择框不能用 display:none/hidden，部分浏览器会直接拦 showPicker/click */
.sr-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(9, 107, 104, 0.3);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(9, 107, 104, 0.08), rgba(255, 255, 255, 0.55));
  cursor: pointer;
}

.dropzone strong {
  display: block;
  font-size: 0.96rem;
}

.dropzone p {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.dropzone.compact {
  min-height: 164px;
  display: grid;
  align-content: center;
}

.inline-actions,
.primary-actions,
.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* 暖纸工房按钮：短方角印章感，避免同质白边胶囊 */
button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  min-height: 40px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  box-shadow: var(--btn-shadow);
  transition:
    transform 0.18s ease,
    opacity 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 4px 10px rgba(52, 33, 13, 0.08);
}

button:focus-visible {
  outline: 2px solid rgba(9, 107, 104, 0.55);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 42%),
    linear-gradient(135deg, #0d8581 0%, var(--accent) 48%, var(--accent-strong) 100%);
  color: #fff;
  border-color: rgba(8, 75, 74, 0.35);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 12px 26px rgba(9, 107, 104, 0.28);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 16px 30px rgba(9, 107, 104, 0.34);
}

.btn-secondary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 240, 226, 0.88));
  color: var(--text);
  border-color: rgba(90, 70, 46, 0.16);
}

.btn-secondary:hover:not(:disabled) {
  background: #fff;
  border-color: rgba(9, 107, 104, 0.28);
  color: var(--accent-strong);
}

.btn-accent {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 55%),
    rgba(216, 111, 69, 0.16);
  color: #8c431c;
  border-color: rgba(216, 111, 69, 0.28);
}

.btn-accent:hover:not(:disabled) {
  background: rgba(216, 111, 69, 0.22);
  border-color: rgba(216, 111, 69, 0.42);
}

.btn-danger,
.btn-danger-text {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 55%),
    var(--danger-soft);
  color: var(--danger);
  border-color: rgba(180, 67, 43, 0.22);
}

.btn-danger:hover:not(:disabled),
.btn-danger-text:hover:not(:disabled) {
  background: rgba(180, 67, 43, 0.18);
  border-color: rgba(180, 67, 43, 0.38);
  color: #8f2f1c;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border-color: rgba(90, 70, 46, 0.1);
}

.btn-xs {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 8px;
}

/* 单张结果卡底部操作：均分且可换行，不与顶栏工具条共用挤压规则 */
.result-item .result-actions,
.result-body .result-actions,
.asset-body .result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(90, 70, 46, 0.08);
}

.result-item .result-actions > button,
.result-body .result-actions > button,
.asset-body .result-actions > button {
  flex: 1 1 auto;
  min-width: 72px;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 0.84rem;
  white-space: nowrap;
}

.result-item .result-actions > .btn-danger,
.result-item .result-actions > .btn-danger-text,
.result-body .result-actions > .btn-danger,
.result-body .result-actions > .btn-danger-text,
.asset-body .result-actions > .btn-danger {
  flex: 0 0 auto;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(90, 70, 46, 0.08);
  color: var(--muted);
  font-size: 0.84rem;
}

.thumb-grid,
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.thumb {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(90, 70, 46, 0.08);
  background: rgba(255, 255, 255, 0.65);
}

.thumb img {
  width: 100%;
  height: 108px;
  object-fit: cover;
  display: block;
}

.thumb-meta {
  padding: 8px 10px 10px;
  display: grid;
  gap: 4px;
}

.thumb-name {
  font-size: 0.78rem;
  font-weight: 700;
  word-break: break-all;
}

.thumb-size {
  color: var(--muted);
  font-size: 0.74rem;
}

.thumb button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 999px;
  border-color: transparent;
  background: rgba(31, 26, 22, 0.72);
  color: #fff;
  box-shadow: 0 6px 14px rgba(31, 26, 22, 0.22);
}

.status-box {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(90, 70, 46, 0.08);
  display: grid;
  gap: 8px;
}

.status-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.status-title small {
  color: var(--muted);
  font-weight: 600;
}

.status-message {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.results-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 12px;
}

.results-heading h2 {
  margin: 0;
}

.results-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* 顶栏工具条：分组 + 可换行，避免五颗按钮挤成一行叠字 */
.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(90, 70, 46, 0.08);
}

.toolbar-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar-group + .toolbar-group {
  padding-left: 12px;
  border-left: 1px solid rgba(90, 70, 46, 0.12);
}

.results-toolbar > button,
.toolbar-group > button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 14px;
  font-size: 0.86rem;
  white-space: nowrap;
}

.results-toolbar-compact {
  justify-content: flex-end;
  background: transparent;
  border: none;
  padding: 0;
}

.results-toolbar .results-clear {
  margin-left: auto;
  color: var(--danger);
  font-weight: 650;
}

.results-toolbar .results-clear:hover:not(:disabled) {
  background: var(--danger-soft);
  color: #8f2f1c;
  border-color: rgba(180, 67, 43, 0.18);
}

/* 状态信息：安静文字条，不再用一排厚胶囊抢视觉 */
.results-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
  margin-bottom: 16px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.results-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
}

.results-meta-item:not(:last-child)::after {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-left: 10px;
  border-radius: 50%;
  background: rgba(90, 70, 46, 0.28);
  vertical-align: middle;
}

.results-meta-item strong {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.results-meta-id {
  min-width: 0;
}

.results-meta-id strong {
  display: inline-block;
  max-width: min(28ch, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
}

.result-card {
  border-radius: var(--radius-xl);
  padding: 18px;
}

.gallery {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.result-item {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(90, 70, 46, 0.08);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.result-item.is-task {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.58);
}

.result-item.is-selected {
  border-color: rgba(9, 107, 104, 0.55);
  box-shadow: 0 0 0 2px rgba(9, 107, 104, 0.18), var(--shadow);
}

.result-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(9, 107, 104, 0.06), rgba(216, 111, 69, 0.12));
}

/* 结果卡角标选择：印章式勾选，不挡大图预览 */
.result-select {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(31, 26, 22, 0.52);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  user-select: none;
}

.result-select input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.result-item.is-selected .result-select {
  background: rgba(9, 107, 104, 0.88);
  border-color: rgba(255, 255, 255, 0.35);
}

.result-body {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.result-body h3 {
  margin: 0;
  font-size: 0.98rem;
}

.result-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* 手稿摘录条：默认只露一行，点击打开全文弹窗 */
.prompt-peek {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 9px 11px;
  min-height: 0;
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(90, 70, 46, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 55%),
    rgba(248, 241, 228, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.prompt-peek:hover {
  border-color: rgba(9, 107, 104, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), transparent 55%),
    rgba(255, 250, 240, 0.98);
  transform: translateY(-1px);
}

.prompt-peek:focus-visible {
  outline: 2px solid rgba(9, 107, 104, 0.45);
  outline-offset: 2px;
}

.prompt-peek.is-danger {
  border-color: rgba(180, 67, 43, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 55%),
    var(--danger-soft, rgba(180, 67, 43, 0.12));
  color: var(--danger, #b4432b);
}

.prompt-peek-label {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: rgba(9, 107, 104, 0.1);
  color: var(--accent-strong, #085350);
}

.prompt-peek.is-danger .prompt-peek-label {
  background: rgba(180, 67, 43, 0.14);
  color: var(--danger, #b4432b);
}

.prompt-peek-excerpt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.prompt-peek-cue {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.prompt-peek.is-danger .prompt-peek-cue {
  color: var(--danger, #b4432b);
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* 卡片内一键提取：填满原先空荡的 meta 下方区域 */
.result-extract-cta {
  width: 100%;
  justify-content: center;
  min-height: 38px;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}

.result-extract-cta:disabled {
  opacity: 0.55;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

details {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(90, 70, 46, 0.08);
}

summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

pre {
  margin: 0;
  padding: 0 16px 16px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.6;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  border-radius: var(--radius-xl);
  border: 1px dashed rgba(90, 70, 46, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.68)),
    radial-gradient(circle at top right, rgba(9, 107, 104, 0.08), transparent 28%);
  text-align: center;
  padding: 24px;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.empty-state p {
  margin: 0;
  max-width: 34ch;
  color: var(--muted);
  line-height: 1.7;
}

.extractor-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.preview-stack {
  display: grid;
  gap: 14px;
}

.keep-region-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.keep-region-bar .hint {
  flex: 1 1 180px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.keep-brush-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.keep-brush-size input[type="range"] {
  width: 88px;
}

.keep-lasso-shell.keep-eraser-active canvas {
  cursor: cell;
}

.canvas-shell {
  overflow: hidden;
  border: 1px solid rgba(90, 70, 46, 0.1);
  border-radius: 22px;
  background-color: rgba(255, 255, 255, 0.72);
  background-image:
    linear-gradient(45deg, rgba(9, 107, 104, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(9, 107, 104, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(9, 107, 104, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(9, 107, 104, 0.08) 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.keep-lasso-shell {
  min-height: 220px;
}

.keep-lasso-shell.keep-lasso-active {
  outline: 2px solid rgba(216, 111, 69, 0.55);
  outline-offset: 2px;
}

.keep-lasso-shell.keep-lasso-active canvas {
  cursor: crosshair;
  touch-action: none;
}

.keep-lasso-shell.keep-transform-ready canvas {
  cursor: default;
  touch-action: none;
}

canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.asset-card {
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(90, 70, 46, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.asset-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  padding: 12px;
  cursor: zoom-in;
  background:
    linear-gradient(45deg, rgba(9, 107, 104, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(9, 107, 104, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(9, 107, 104, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(9, 107, 104, 0.08) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.asset-card img:hover,
.asset-card img:focus-visible {
  outline: 2px solid rgba(9, 107, 104, 0.45);
  outline-offset: -2px;
}

.preview-background-black .canvas-shell,
.preview-background-black .asset-card img {
  background: #000;
}

.asset-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.asset-body h3,
.asset-body p {
  margin: 0;
}

.asset-body p {
  color: var(--muted);
  font-size: 0.84rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 26, 22, 0.38);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 252, 245, 0.96);
  box-shadow: 0 28px 90px rgba(31, 26, 22, 0.28);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid rgba(90, 70, 46, 0.1);
}

.modal-header h2 {
  margin: 0 0 6px;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.preview-card {
  width: min(1400px, 100%);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: auto;
  background: repeating-conic-gradient(#efe7da 0% 25%, #fbf7f0 0% 50%) 50% / 24px 24px;
}

.preview-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 120px);
  object-fit: contain;
  cursor: zoom-in;
}

.preview-stage.is-actual img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.preview-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-item > img {
  cursor: zoom-in;
}

#confirmModal {
  z-index: 30;
}

.confirm-card {
  width: min(440px, 100%);
}

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

#promptModal {
  z-index: 28;
}

#extractFromResultsModal {
  z-index: 29;
}

.extract-modal-card {
  width: min(760px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
}

.extract-modal-body {
  gap: 18px;
}

.extract-modal-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(90, 70, 46, 0.1);
  background: rgba(255, 255, 255, 0.55);
}

.extract-modal-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.extract-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.extract-pick-card {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(90, 70, 46, 0.1);
  background: rgba(248, 241, 228, 0.9);
  color: var(--ink, var(--text));
  cursor: pointer;
  text-align: left;
  min-height: 0;
  box-shadow: none;
  font-weight: 600;
}

.extract-pick-card:hover {
  transform: none;
  border-color: rgba(9, 107, 104, 0.35);
}

.extract-pick-card.is-on {
  border-color: rgba(9, 107, 104, 0.45);
  box-shadow: 0 0 0 2px rgba(9, 107, 104, 0.14);
}

.extract-pick-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  background: #efe7da;
}

.extract-pick-card span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.extract-pick-card input {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.extract-modal-settings label {
  display: grid;
  gap: 6px;
}

.extract-modal-status {
  min-height: 1.4em;
}

.prompt-modal-card {
  width: min(720px, 100%);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prompt-modal-card .modal-header {
  flex-shrink: 0;
}

.prompt-modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 22px 22px;
}

/* 弹窗正文保留换行层级，像展开的工单手稿 */
.prompt-manuscript {
  margin: 0;
  padding: 18px 18px 20px;
  border-radius: 14px;
  border: 1px solid rgba(90, 70, 46, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 30%),
    repeating-linear-gradient(
      transparent,
      transparent 27px,
      rgba(90, 70, 46, 0.045) 27px,
      rgba(90, 70, 46, 0.045) 28px
    ),
    #f7f0e4;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: min(360px, 100%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(90, 70, 46, 0.1);
}

.zoom-control input {
  width: 180px;
  padding: 0;
}

.zoom-control input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.zoom-control select {
  width: auto;
}

.editor-canvas-shell {
  max-height: min(62vh, 620px);
  overflow: auto;
  cursor: crosshair;
}

.editor-canvas-shell canvas {
  max-width: none;
  transform-origin: top left;
  image-rendering: auto;
}

.fine-print {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (max-width: 1080px) {
  .hero,
  .workspace,
  .extractor-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .page {
    width: min(100vw - 20px, 100%);
    margin-top: 12px;
  }

  .hero-card,
  .stat-card,
  .panel,
  .result-card {
    border-radius: 22px;
  }

  .hero-stats,
  .field-row {
    grid-template-columns: 1fr;
  }

  .results-toolbar {
    gap: 8px;
    padding: 10px;
  }

  .toolbar-group {
    width: 100%;
  }

  .toolbar-group + .toolbar-group {
    padding-left: 0;
    border-left: none;
    padding-top: 8px;
    border-top: 1px solid rgba(90, 70, 46, 0.1);
  }

  .toolbar-group > button {
    flex: 1 1 calc(50% - 4px);
  }

  .results-toolbar .results-clear {
    margin-left: 0;
    width: 100%;
  }

  .result-item .result-actions,
  .result-body .result-actions,
  .asset-body .result-actions {
    width: 100%;
  }

  .result-item .result-actions > button,
  .result-body .result-actions > button,
  .asset-body .result-actions > button {
    flex: 1 1 calc(50% - 4px);
  }
}

@media (max-width: 520px) {
  .top-tabs {
    display: flex;
    width: 100%;
  }

  .tab-button {
    flex: 1;
    padding-inline: 10px;
  }

  .hero-card,
  .stat-card,
  .panel,
  .result-card {
    padding: 18px;
  }

  .hero h1 {
    font-size: 2.35rem;
  }
}

/* 线上登录门禁页：与主站同色调，单卡片聚焦输入 */
.login-body {
  min-height: 100vh;
}

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

.login-card {
  width: min(420px, 100%);
  padding: 32px 28px 28px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.login-eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.login-card h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", "PingFang SC", "Microsoft YaHei", serif;
  font-size: 2rem;
  line-height: 1.2;
}

.login-subtitle {
  margin: 10px 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

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

.login-field {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.login-field-label {
  line-height: 1.3;
}

.login-input-wrap {
  position: relative;
  display: block;
}

.login-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 12px 14px 12px 42px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}

.login-form input:focus {
  outline: 2px solid rgba(9, 107, 104, 0.28);
  border-color: rgba(9, 107, 104, 0.45);
}

.login-form input:focus + .login-field-icon,
.login-input-wrap:focus-within .login-field-icon {
  color: var(--accent);
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
}

.login-submit {
  width: 100%;
  margin-top: 4px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-submit-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.top-tabs-spacer {
  flex: 1;
}

.tab-logout {
  margin-left: auto;
}
