:root {
  color-scheme: light;
  --ink: #181b1f;
  --muted: #686f78;
  --line: #dfe2e5;
  --paper: #f3f1ec;
  --surface: #fbfaf7;
  --accent: #19705b;
  --accent-soft: #dcebe5;
  --danger: #a03b31;
  font-family: Geist, "Microsoft YaHei UI", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.advanced { margin: 18px 0; }
.advanced summary { cursor: pointer; color: var(--muted); padding: 10px 0; font-size: 13px; }
.advanced[open] > .form-grid { padding: 18px 0; }
.product-cell { display: grid; grid-template-columns: 76px minmax(160px, 1fr); gap: 14px; min-width: 300px; white-space: normal; }
.product-cell strong { display: block; line-height: 1.5; margin-bottom: 5px; }
.product-cell small { display: block; font-weight: 400; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.product-image { display: grid; place-items: center; align-self: start; height: 76px; background: #eeece7; color: var(--muted); font-size: 11px; }
.product-image img { width: 76px; height: 76px; object-fit: contain; }
.spec-cell { white-space: pre-line; min-width: 140px; max-width: 240px; line-height: 1.8; text-align: left; overflow-wrap: anywhere; }
.photo-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.flaw-summary { display: block; white-space: normal; max-width: 240px; margin-bottom: 8px; color: var(--muted); line-height: 1.5; }
.photo-tabs button { border: 1px solid var(--line); background: transparent; }
.photo-tabs button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.photo-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.drawer .image-grid img { object-fit: contain; }
body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-underline-offset: 4px; }
:is(button,a,input,select,summary,textarea):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip-link { position: absolute; top: -80px; left: 20px; padding: 12px; background: var(--surface); z-index: 30; }
.skip-link:focus { top: 10px; }
.license-panel { margin-top: 28px; padding: 26px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.license-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.license-heading .eyebrow { margin-bottom: 8px; }
.license-badge { background: #eceae4; color: var(--muted); padding: 7px 12px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.license-badge[data-active="true"] { color: var(--accent); background: var(--accent-soft); }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; max-width: 800px; }
.inline-form label { flex: 1 1 240px; }
.quota-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px 24px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.quota-row small { color: var(--muted); line-height: 1.65; }
.check-line { display: flex; align-items: center; gap: 10px; margin-top: 20px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.check-line input { width: 18px; height: 18px; min-height: auto; accent-color: var(--accent); }
.workflow { display: flex; gap: 28px; flex-wrap: wrap; padding: 24px 0 0; font-size: 13px; }
.workflow a { text-decoration: none; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.result-toolbar { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) auto; align-items: end; gap: 18px; margin-bottom: 24px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 20px; font-size: 13px; }
.app-footer { display: flex; justify-content: space-between; gap: 24px; margin-top: 32px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.app-footer p { margin: 0; max-width: 650px; }
.compact-header h1 { font-size: clamp(36px, 5vw, 56px); }
.generated-panel { padding: 24px; margin-top: 24px; background: var(--accent-soft); border-radius: 12px; }
textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; font: 13px/1.8 ui-monospace, monospace; }
.admin-table td { white-space: normal; min-width: 120px; }
.admin-table td:first-child { white-space: pre-line; min-width: 260px; overflow-wrap: anywhere; font-size: 12px; }
.admin-table .row-actions { flex-wrap: wrap; }
.audit-log { max-height: 400px; overflow: auto; font-size: 12px; overflow-wrap: anywhere; }
.audit-log p { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
@media (max-width: 700px) {
  .license-panel { padding: 20px 16px; }
  .result-toolbar { grid-template-columns: 1fr; }
  .app-footer { flex-direction: column; gap: 8px; }
  .actions { flex-wrap: wrap; }
  .inline-form button { flex-grow: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
button, input, select { font: inherit; }
.shell { width: min(1400px, calc(100% - 48px)); margin: 0 auto; padding: 52px 0 80px; }
.masthead { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px; padding: 0 0 42px; border-bottom: 1px solid var(--ink); }
.eyebrow { margin: 0 0 14px; color: var(--accent); font: 700 12px/1.2 ui-monospace, "Cascadia Mono", monospace; letter-spacing: .17em; }
h1 { margin: 0; max-width: 720px; font-size: clamp(36px, 5vw, 62px); line-height: 1.1; letter-spacing: -.04em; font-weight: 650; text-wrap: balance; }
.lede { max-width: 620px; margin: 22px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.status { display: flex; align-items: center; gap: 10px; min-width: 150px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; }
.status span { width: 9px; height: 9px; border-radius: 50%; background: #9da3aa; }
.status b { font-size: 13px; font-weight: 600; }
.status[data-state="loading"] span { background: #b88224; animation: breathe 1.2s ease-in-out infinite; }
.status[data-state="success"] span { background: var(--accent); }
.status[data-state="error"] span { background: var(--danger); }
.mast-actions { display: flex; align-items: center; gap: 10px; }
.wallet-button { min-height: 44px; border: 1px solid var(--ink); background: var(--ink); color: white; }
.wallet-button:hover { background: #30343a; }
section { padding: 38px 0; border-bottom: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 420px); align-items: start; gap: 32px; margin-bottom: 28px; }
.section-head > div { display: flex; align-items: baseline; gap: 16px; }
.section-head span { color: var(--accent); font: 700 12px ui-monospace, monospace; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.section-head p { margin: 0; color: var(--muted); line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 22px; }
.form-grid .wide { grid-column: span 2; }
label { display: grid; gap: 8px; align-content: start; }
label > span { font-size: 13px; font-weight: 650; }
label small { color: var(--muted); line-height: 1.5; }
.login-action { display: grid; align-content: end; gap: 8px; }
.login-action small { color: var(--muted); line-height: 1.5; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cfd3d6; border-radius: 9px; background: var(--surface); color: var(--ink); outline: none; transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(25,112,91,.1); }
.actions { display: flex; gap: 10px; margin-top: 26px; }
button { min-height: 44px; padding: 0 18px; border-radius: 9px; cursor: pointer; transition: transform .2s cubic-bezier(.16,1,.3,1), background .2s ease, border-color .2s ease; }
button:active { transform: translateY(1px) scale(.985); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { border: 1px solid var(--accent); background: var(--accent); color: white; font-weight: 700; }
.primary:hover { background: #145f4d; }
.secondary { border: 1px solid #cfd3d6; background: transparent; color: var(--ink); }
.secondary:hover:not(:disabled) { border-color: #989fa6; background: rgba(255,255,255,.45); }
.progress { height: 3px; margin-top: 24px; overflow: hidden; background: var(--accent-soft); }
.progress i { display: block; width: 36%; height: 100%; background: var(--accent); animation: progress 1.15s ease-in-out infinite; }
.error { margin: 18px 0 0; padding: 12px 14px; color: var(--danger); background: #f5e4e0; border-left: 3px solid var(--danger); }
.mapping-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.result-head { align-items: center; }
.result-head button { justify-self: end; }
.metrics { display: grid; grid-template-columns: 1.4fr 1fr 1fr; margin-bottom: 26px; border-top: 1px solid var(--line); }
.metrics > div { padding: 22px 20px 12px 0; border-right: 1px solid var(--line); }
.metrics > div + div { padding-left: 24px; }
.metrics small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.metrics strong { font: 650 34px/1 ui-monospace, "Cascadia Mono", monospace; letter-spacing: -.05em; }
.empty { display: grid; justify-items: start; gap: 8px; padding: 52px 0; }
.empty-mark { display: flex; align-items: end; gap: 5px; height: 34px; margin-bottom: 8px; }
.empty-mark span { width: 7px; background: var(--accent); border-radius: 2px 2px 0 0; animation: bars 1.8s ease-in-out infinite; }
.empty-mark span:nth-child(1) { height: 14px; }
.empty-mark span:nth-child(2) { height: 30px; animation-delay: .15s; }
.empty-mark span:nth-child(3) { height: 21px; animation-delay: .3s; }
.empty h3 { margin: 0; font-size: 20px; }
.empty p { margin: 0; color: var(--muted); }
.table-wrap { overflow: auto; border: 1px solid var(--line); background: var(--surface); }
.bottom-scan-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 16px; padding: 18px 20px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 28px rgba(57,53,45,.08); }
.bottom-scan-actions strong, .bottom-scan-actions small { display: block; }
.bottom-scan-actions strong { margin-bottom: 5px; font-size: 14px; }
.bottom-scan-actions small { color: var(--muted); line-height: 1.5; }
.bottom-scan-buttons { display: flex; flex: 0 0 auto; gap: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: #eceae4; color: var(--muted); font-size: 12px; font-weight: 650; }
th:first-child, td:first-child { text-align: left; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
td { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 13px; }
td:first-child { font-family: inherit; font-weight: 600; }
.positive { color: var(--danger); font-weight: 700; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.row-actions button { min-height: 34px; padding: 0 10px; border: 1px solid #cfd3d6; background: transparent; font-size: 12px; }
.row-actions .bargain { border-color: var(--accent); color: var(--accent); }
.scrim { position: fixed; inset: 0; background: rgba(24,27,31,.26); backdrop-filter: blur(3px); z-index: 20; }
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 21; width: min(560px, 100%); padding: 28px; background: var(--surface); box-shadow: -24px 0 70px rgba(57,53,45,.16); transform: translateX(102%); transition: transform .35s cubic-bezier(.16,1,.3,1); overflow: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 24px; align-items: start; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 30px; }
.close-button { width: 42px; min-height: 42px; padding: 0; border: 1px solid var(--line); background: transparent; font-size: 25px; line-height: 1; }
.drawer-body { padding: 28px 0 40px; }
.drawer.photo-dialog { inset: 50% auto auto 50%; width: min(700px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 24px; border-radius: 8px; box-shadow: 0 18px 60px rgba(0,0,0,.2); transform: translate(-50%, -48%); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, transform .2s ease, visibility .2s; }
.drawer.photo-dialog.open { transform: translate(-50%, -50%); opacity: 1; visibility: visible; pointer-events: auto; }
.photo-dialog .drawer-head { padding-bottom: 12px; border: 0; align-items: center; }
.photo-dialog .drawer-head .eyebrow { display: none; }
.photo-dialog .drawer-head h2 { font-size: 18px; margin: 0; }
.photo-dialog .close-button { border: 0; color: var(--muted); }
.photo-dialog .drawer-body { padding: 0; }
.photo-dialog .drawer-body > .detail-note { margin: 0 0 12px; font-size: 13px; }
.photo-dialog .photo-tabs { margin: 12px 0; }
.photo-dialog .photo-tabs button { min-height: 36px; padding: 0 12px; }
.photo-dialog h3 { font-size: 15px; margin: 16px 0 10px; }
.photo-dialog ul { padding-left: 24px; font-size: 14px; }
.photo-dialog .image-grid { grid-template-columns: repeat(auto-fill, 100px); gap: 8px; }
.photo-dialog .image-grid figure { border-radius: 0; }
.photo-dialog .image-grid img { width: 100%; height: 100px; }
.drawer-loading { display: grid; gap: 12px; }
.skeleton { height: 110px; border-radius: 10px; background: linear-gradient(90deg, #ebe9e3 20%, #f7f5f0 48%, #ebe9e3 76%); background-size: 220% 100%; animation: shimmer 1.5s ease infinite; }
.image-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.image-grid figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #e9e7e1; }
.image-grid img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.photo-thumbnail { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: zoom-in; }
.photo-thumbnail:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.photo-preview { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 56px 24px 48px; border: 0; background: transparent; color: white; }
.photo-preview[open] { display: flex; align-items: center; justify-content: center; }
.photo-preview::backdrop { background: rgba(0, 0, 0, .86); }
.photo-preview-stage { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 100%; max-height: 100%; }
.photo-preview-viewport { flex: 0 1 auto; max-width: calc(100vw - 176px); max-height: calc(100dvh - 112px); overflow: auto; background: #111; cursor: zoom-in; scrollbar-width: none; touch-action: none; }
.photo-preview-viewport::-webkit-scrollbar { display: none; }
.photo-preview-viewport[data-zoomed="true"] { cursor: grab; }
.photo-preview-viewport[data-dragging="true"] { cursor: grabbing; }
.photo-preview img { display: block; max-width: calc(100vw - 176px); max-height: calc(100dvh - 112px); object-fit: contain; user-select: none; }
.photo-preview-close { position: absolute; top: 12px; right: 16px; width: 44px; padding: 0; border: 1px solid #ffffff66; background: #222; color: white; font-size: 30px; }
.photo-preview-nav { flex: 0 0 48px; width: 48px; height: 56px; padding: 0; border: 1px solid #ffffff66; background: #222; color: white; font-size: 40px; line-height: 1; }
.photo-preview-nav:hover { background: #444; }
.photo-preview-counter { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 14px; }
@media (max-width: 560px) {
  .photo-preview { padding: 64px 8px 88px; }
  .photo-preview-stage { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .photo-preview-viewport { grid-column: 1 / -1; grid-row: 1; max-width: calc(100vw - 16px); max-height: calc(100dvh - 152px); }
  .photo-preview img { max-width: calc(100vw - 16px); max-height: calc(100dvh - 152px); }
  .photo-preview-nav { width: 100%; height: 48px; }
  .photo-preview-prev { grid-column: 1; }
  .photo-preview-next { grid-column: 2; }
  .photo-preview-counter { bottom: 34px; }
}
.detail-note { color: var(--muted); line-height: 1.65; }
.wallet-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.wallet-row { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.wallet-row span { color: var(--muted); font-size: 13px; }
.wallet-row b { font-family: ui-monospace, "Cascadia Mono", monospace; }
.bargain-form { display: grid; gap: 18px; }
.pending-action { padding: 14px; border-left: 3px solid #b88224; background: #f6edda; color: #735514; line-height: 1.6; }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -70% 0; } }
@keyframes progress { from { transform: translateX(-110%); } to { transform: translateX(310%); } }
@keyframes breathe { 50% { transform: scale(1.4); opacity: .5; } }
@keyframes bars { 50% { transform: scaleY(.55); opacity: .55; } }
@media (max-width: 900px) {
  .shell { width: min(100% - 28px, 760px); padding-top: 28px; }
  .masthead, .section-head { grid-template-columns: 1fr; }
  .status { width: max-content; }
  .mast-actions { align-items: flex-start; flex-wrap: wrap; }
  .form-grid, .mapping-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .wide { grid-column: span 2; }
  .login-action { align-content: start; }
}
@media (max-width: 560px) {
  .form-grid, .mapping-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: span 1; }
  .metrics { grid-template-columns: 1fr; }
  .metrics > div, .metrics > div + div { padding-left: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .result-head button { justify-self: start; }
  .bottom-scan-actions { align-items: stretch; flex-direction: column; }
  .bottom-scan-buttons, .bottom-scan-buttons button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
