:root {
  color-scheme: light;
  --ink: #24221f;
  --muted: #77716a;
  --paper: #f5f0e8;
  --surface: #fffdf9;
  --line: #dfd8cd;
  --line-soft: #ece6dc;
  --accent: #ce4f2b;
  --accent-dark: #a83b1f;
  --shadow: 0 18px 60px rgba(65, 52, 34, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.9), transparent 30rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(206, 79, 43, 0.25);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 42px 30px;
}

.topbar {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(113, 102, 88, 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 12px;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 var(--ink);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

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

.beta-notice {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 14px 0 0;
  padding: 9px 14px;
  border: 1px solid #ead6b4;
  border-radius: 11px;
  background: #fff8eb;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.beta-notice strong {
  color: #b06b21;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

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

.button-primary {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 8px 20px rgba(206, 79, 43, 0.18);
}

.button-primary:hover {
  background: var(--accent-dark);
}

.button-secondary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.35);
}

.button-danger {
  color: #a33420;
  border-color: #e6b9ae;
  background: #fff6f3;
}

.intro {
  min-height: 264px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 56px 4px 42px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(38px, 5.2vw, 72px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.intro-copy {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.privacy-note {
  min-width: 246px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.55);
}

.privacy-note strong,
.privacy-note span {
  display: block;
}

.privacy-note strong {
  font-size: 13px;
}

.privacy-note span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.privacy-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ca24d;
  box-shadow: 0 0 0 5px rgba(44, 162, 77, 0.12);
}

.workspace {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.search-wrap {
  height: 46px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf7f2;
}

.search-icon {
  width: 15px;
  height: 15px;
  position: relative;
  border: 1.8px solid var(--muted);
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  width: 7px;
  height: 1.8px;
  position: absolute;
  right: -5px;
  bottom: -3px;
  background: var(--muted);
  transform: rotate(45deg);
  border-radius: 2px;
}

.search-wrap input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.search-wrap kbd {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: white;
  font-size: 10px;
}

.record-count {
  min-width: 90px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.matrix-wrap {
  max-height: 58vh;
  overflow: auto;
}

.matrix {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.matrix th,
.matrix td {
  width: 218px;
  min-width: 218px;
  padding: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  text-align: left;
}

.matrix th {
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0 16px;
  background: #f9f5ef;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.matrix .sticky-column {
  width: 244px;
  min-width: 244px;
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 10px 0 22px rgba(70, 55, 32, 0.045);
}

.matrix th.sticky-column {
  z-index: 4;
}

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

.platform-head i,
.platform-badge {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: white;
  background: var(--platform);
  font-style: normal;
  font-size: 10px;
}

.platform-head small {
  margin-left: auto;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
}

.identity-cell {
  width: 100%;
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.identity-cell:hover {
  background: #faf6f0;
}

.identity-cell.is-match,
.mobile-friend .is-match {
  background: #fff1e9;
  box-shadow: inset 3px 0 0 var(--accent);
}

.avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--platform) 30%, white);
  border-radius: 14px;
  color: white;
  background: var(--platform);
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
}

.avatar img,
.avatar-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar-small {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 13px;
}

.avatar-large {
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

.identity-copy {
  min-width: 0;
  display: block;
}

.identity-copy strong,
.identity-copy small {
  display: block;
}

.identity-copy strong {
  max-width: 130px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.identity-empty {
  justify-content: center;
  color: #aaa298;
  font-size: 11px;
}

.empty-plus {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px dashed #cfc6b9;
  border-radius: 9px;
  font-size: 16px;
}

.empty-state {
  min-height: 360px;
  padding: 70px 24px;
  text-align: center;
}

.empty-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.empty-visual span {
  min-width: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font-size: 11px;
  box-shadow: 0 8px 20px rgba(60, 45, 28, 0.08);
}

.empty-visual i {
  width: 24px;
  height: 1px;
  background: #cfc5b7;
}

.empty-state h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 28px;
  font-weight: 500;
}

.empty-state p,
.no-results span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state .button {
  margin-top: 22px;
}

.no-results {
  min-height: 260px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 30px;
  text-align: center;
}

.mobile-list {
  display: none;
}

.footer {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 4px 0;
  color: var(--muted);
  font-size: 11px;
}

.footer div {
  display: flex;
  gap: 18px;
}

.text-button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.text-button:hover {
  border-color: currentColor;
  color: var(--ink);
}

.danger-text {
  color: #a64731;
}

.dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(84vh, 820px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 28px 100px rgba(26, 22, 17, 0.25);
}

.dialog::backdrop {
  background: rgba(32, 28, 23, 0.42);
  backdrop-filter: blur(4px);
}

.dialog form {
  max-height: inherit;
  display: flex;
  flex-direction: column;
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  padding: 22px 26px;
}

.dialog-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.dialog-head h2 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 25px;
  font-weight: 500;
}

.dialog-head .eyebrow {
  margin-bottom: 7px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.dialog-body {
  padding: 26px;
  overflow-y: auto;
}

.dialog-actions {
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  background: #faf7f2;
}

.dialog-spacer {
  flex: 1;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wechat-block {
  margin-bottom: 30px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line-soft);
}

.platform-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  background: var(--platform, #1aad19);
}

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

.platform-editor {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: #fff;
}

.platform-editor-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}

.platform-editor-head .scan-button {
  margin-left: auto;
}

.scan-button {
  padding: 3px 7px;
  border: 1px solid #ded4c7;
  border-radius: 7px;
  background: #faf7f2;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
}

.scan-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.identity-editor {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.identity-editor-primary {
  align-items: center;
}

.field {
  min-width: 0;
  flex: 1;
  display: block;
}

.field > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.field b {
  color: var(--accent);
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #fdfbf8;
  font-size: 13px;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(206, 79, 43, 0.1);
}

.avatar-picker {
  width: 92px;
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 5px;
  cursor: pointer;
}

.avatar-preview {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #bdb3a5;
  border-radius: 18px;
  background: #f4eee6;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  transition: border-color 150ms ease, background 150ms ease;
}

.avatar-picker:hover .avatar-preview,
.avatar-picker.dragging .avatar-preview {
  border-color: var(--accent);
  background: #fff1e9;
}

.avatar-hint {
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.avatar-picker-small {
  width: 54px;
}

.avatar-picker-small .avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 14px;
}

.platform-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.platform-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: white;
  font-size: 13px;
}

.platform-row small {
  color: var(--muted);
  font-size: 10px;
}

.platform-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.add-platform {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.sync-dialog {
  width: min(620px, calc(100vw - 28px));
}

.sync-privacy {
  padding: 16px;
  border: 1px solid #cfe3d2;
  border-radius: 13px;
  background: #f4faf4;
}

.sync-privacy strong,
.sync-privacy p {
  display: block;
  margin: 0;
}

.sync-privacy p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

#sync-disconnected {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

#sync-disconnected .button {
  justify-self: start;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: white;
}

.sync-status strong,
.sync-status small {
  display: block;
}

.sync-status small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 12px;
}

.ocr-dialog {
  width: min(960px, calc(100vw - 28px));
  max-height: min(92vh, 920px);
}

.ocr-dialog-body {
  display: grid;
  gap: 18px;
}

.ocr-privacy {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d9e8d9;
  border-radius: 12px;
  background: #f4faf4;
}

.ocr-privacy.is-cloud {
  border-color: #ead6b4;
  background: #fff8eb;
}

.ocr-privacy.is-cloud .privacy-dot {
  background: #d89530;
  box-shadow: 0 0 0 5px rgba(216, 149, 48, 0.14);
}

.ocr-privacy p,
.ocr-privacy strong,
.ocr-privacy small {
  display: block;
  margin: 0;
}

.ocr-privacy strong {
  font-size: 12px;
}

.ocr-privacy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.ocr-dropzone {
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed #b9ad9e;
  border-radius: 16px;
  background: #faf7f2;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.ocr-dropzone:hover,
.ocr-dropzone.dragging {
  border-color: var(--accent);
  background: #fff3ec;
}

.ocr-dropzone strong {
  font-size: 14px;
}

.ocr-dropzone small {
  color: var(--muted);
  font-size: 10px;
}

.ocr-dropzone .button {
  display: grid;
  place-items: center;
  margin-top: 8px;
}

.ocr-drop-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(60, 45, 28, 0.08);
}

.ocr-workspace {
  display: grid;
  gap: 18px;
}

.ocr-progress {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: #fff;
}

.ocr-progress > span {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 2px solid #e0d7cb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ocr-spin 800ms linear infinite;
}

.ocr-progress.is-complete > span {
  border: 0;
  background: #2ca24d;
  animation: none;
  clip-path: polygon(14% 53%, 0 68%, 40% 100%, 100% 22%, 84% 8%, 39% 71%);
}

.ocr-progress.is-error > span {
  border: 0;
  border-radius: 5px;
  background: #d89530;
  animation: none;
}

.ocr-progress p,
.ocr-progress strong,
.ocr-progress small {
  display: block;
  margin: 0;
}

.ocr-progress strong {
  font-size: 11px;
}

.ocr-progress small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

@keyframes ocr-spin {
  to {
    transform: rotate(360deg);
  }
}

.ocr-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.7fr);
  gap: 20px;
}

.crop-stage {
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(45deg, #eee9e1 25%, transparent 25%),
    linear-gradient(-45deg, #eee9e1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee9e1 75%),
    linear-gradient(-45deg, transparent 75%, #eee9e1 75%),
    #f8f5f0;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#crop-canvas {
  max-width: 100%;
  max-height: 52vh;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.crop-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.ocr-fields {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.ocr-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ocr-candidates button {
  max-width: 100%;
  padding: 6px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ocr-candidates button:hover,
.ocr-candidates button.is-selected {
  border-color: var(--accent);
  background: #fff1e9;
  color: var(--accent);
}

.ocr-candidates small {
  color: var(--muted);
  font-size: 10px;
}

.ocr-fields > .text-button {
  width: fit-content;
  margin-top: auto;
}

.batch-dialog {
  width: min(1080px, calc(100vw - 28px));
  max-height: min(94vh, 960px);
}

.batch-dialog-body,
.batch-workspace {
  display: grid;
  gap: 18px;
}

.batch-result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.8fr);
  gap: 20px;
}

#batch-crop-canvas {
  max-width: 100%;
  max-height: 52vh;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.batch-review {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.batch-summary {
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: #faf7f2;
}

.batch-summary strong,
.batch-summary small {
  display: block;
}

.batch-summary strong {
  font-size: 12px;
}

.batch-summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.batch-items {
  max-height: 52vh;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 3px;
}

.batch-item {
  display: grid;
  grid-template-columns: 22px 48px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: white;
  cursor: pointer;
}

.batch-item.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(206, 79, 43, 0.08);
}

.batch-item.is-duplicate {
  background: #fffaf1;
}

.batch-select {
  display: grid;
  place-items: center;
}

.batch-select input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.batch-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f4eee6;
  color: var(--muted);
  font-family: Georgia, serif;
  font-weight: 700;
}

.batch-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.batch-item-copy {
  min-width: 0;
}

.batch-item-copy input {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfbf8;
  font-size: 12px;
}

.batch-item-copy small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-item-copy .duplicate-copy {
  color: #b06b21;
}

.settings-dialog {
  width: min(640px, calc(100vw - 28px));
}

.settings-toggle {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #faf7f2;
  cursor: pointer;
}

.settings-toggle > span {
  min-width: 0;
  flex: 1;
}

.settings-toggle strong,
.settings-toggle small {
  display: block;
}

.settings-toggle strong {
  font-size: 13px;
}

.settings-toggle small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.settings-toggle input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.settings-fields {
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 12px;
  margin-top: 22px;
}

.settings-warning {
  margin-top: 20px;
  padding: 13px 15px;
  border: 1px solid #ead6b4;
  border-radius: 11px;
  background: #fff8eb;
}

.settings-warning strong {
  font-size: 11px;
}

.settings-warning p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.toast {
  min-width: 180px;
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  font-size: 12px;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0 16px 24px;
  }

  .topbar {
    height: 74px;
  }

  .brand small,
  .topbar .button-ghost {
    display: none;
  }

  .button {
    min-height: 40px;
    padding: 0 13px;
  }

  .intro {
    min-height: 0;
    display: block;
    padding: 38px 2px 28px;
  }

  .beta-notice {
    align-items: flex-start;
    text-align: left;
  }

  h1 {
    font-size: clamp(35px, 11vw, 52px);
  }

  .privacy-note {
    width: fit-content;
    min-width: 0;
    margin-top: 24px;
  }

  .workspace-head {
    display: block;
    padding: 13px;
  }

  .record-count {
    margin: 10px 3px 0;
    text-align: left;
  }

  .search-wrap kbd,
  .matrix-wrap {
    display: none;
  }

  .mobile-list {
    display: grid;
    gap: 12px;
    padding: 13px;
  }

  .mobile-friend {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: white;
  }

  .mobile-baseline {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    background: #faf7f2;
    text-align: left;
  }

  .mobile-baseline span:nth-child(2),
  .mobile-identities button span {
    min-width: 0;
    flex: 1;
  }

  .mobile-baseline small,
  .mobile-baseline strong,
  .mobile-identities small,
  .mobile-identities strong {
    display: block;
  }

  .mobile-baseline small,
  .mobile-identities small {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-baseline i {
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
  }

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

  .mobile-identities button {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px;
    border: 0;
    border-right: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    background: white;
    text-align: left;
  }

  .mobile-identities strong {
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .footer {
    display: block;
    text-align: center;
  }

  .footer div {
    justify-content: center;
    margin-top: 14px;
  }

  .dialog {
    width: calc(100vw - 16px);
    max-height: 92vh;
    border-radius: 18px;
  }

  .dialog-head,
  .dialog-actions,
  .dialog-body {
    padding-left: 17px;
    padding-right: 17px;
  }

  .identity-grid {
    grid-template-columns: 1fr;
  }

  .ocr-result-layout {
    grid-template-columns: 1fr;
  }

  .batch-result-layout {
    grid-template-columns: 1fr;
  }

  .batch-items {
    max-height: 38vh;
  }

  #batch-crop-canvas {
    max-height: 38vh;
  }

  #ocr-wechat-button {
    display: none;
  }

  .settings-fields {
    grid-template-columns: 1fr;
  }

  .crop-stage {
    min-height: 220px;
  }

  #crop-canvas {
    max-height: 42vh;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .dialog-actions .button {
    flex: 1;
  }

  .dialog-actions .button-danger {
    flex-basis: 100%;
    order: 2;
  }
}

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