:root {
  color-scheme: light;
  --page: #eef0f3;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #c9ccd1;
  --cell-dark: #262626;
  --cell-mid: #464646;
  --cell-light: #e7e6e6;
  --cell-soft: #e6e6e6;
  --cell-dim: #d9d9d9;
  --cell-yellow: #fed927;
  --cell-orange: #fe7527;
  --cell-text: #262626;
  --sheet-scale: 1;
  --sheet-render-width: 642px;
  --sheet-render-height: 689px;
  --ui-font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --base-font: "宋体", SimSun, "Microsoft YaHei", sans-serif;
  --label-font: "标小智无界黑", "Microsoft YaHei", "PingFang SC", sans-serif;
  --item-font: "阿里巴巴普惠体 B", "Alibaba PuHuiTi B", "Microsoft YaHei", "PingFang SC", sans-serif;
  --price-font: "阿里巴巴普惠体 H", "Alibaba PuHuiTi H", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--base-font);
}

.sheet-dragging,
.sheet-dragging * {
  user-select: none !important;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  align-items: start;
}

.topbar {
  display: none;
  /*
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  background: #ffffff;
  border-bottom: 1px solid #d7dbe1;
  */
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

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

.actions button,
.price-row button {
  border: 1px solid #b8bec8;
  background: #ffffff;
  color: #1f2937;
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

.actions button:hover,
.price-row button:hover {
  background: #f3f6fa;
}

.workspace {
  min-width: 0;
  display: block;
  padding: 0;
}

.sheet-stage {
  overflow: auto;
  min-height: 100vh;
  padding: 10px;
  background: var(--page);
  border: 0;
}

.excel-sheet {
  position: relative;
  display: grid;
  grid-template-columns: 116px 413px 113px;
  grid-template-rows: 25px 25px 48px 48px 48px 48px 48px 48px 48px 48px 48px 37px 33px 33px 30px 48px 26px;
  width: 642px;
  background: #ffffff;
  transform: scale(var(--sheet-scale));
  transform-origin: top left;
  box-shadow: none;
  user-select: none;
}

.merchant-tools {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 168px;
  max-width: 168px;
  margin: 10px 10px 0 0;
  padding: 6px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
  backdrop-filter: blur(8px);
}

.config-switcher {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid #d8dde5;
}

.config-switcher select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border: 1px solid #b8bec8;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  padding: 0 7px;
  font-family: var(--ui-font);
  font-size: 12px;
}

.merchant-action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.merchant-tools button {
  width: 100%;
  height: 30px;
  border: 1px solid #b8bec8;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2937;
  padding: 0 9px;
  font-family: var(--ui-font);
  font-size: 12px;
  cursor: pointer;
}

.merchant-tools #modeToggleBtn {
  color: #111827;
  border-color: #111827;
  font-weight: 700;
}

.merchant-tools button:hover {
  background: #f3f6fa;
}

.cost-popover {
  position: fixed;
  top: 58px;
  right: 10px;
  z-index: 25;
  min-width: 218px;
  max-width: min(320px, calc(100vw - 20px));
  padding: 10px 12px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.22);
  font-family: var(--ui-font);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.cost-popover.show {
  opacity: 1;
  transform: translateY(0);
}

.cost-popover strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.cost-popover span {
  display: block;
  margin-top: 4px;
  color: #d1d5db;
  font-size: 12px;
  line-height: 1.45;
}

.cost-reference {
  position: fixed;
  top: 58px;
  right: 10px;
  z-index: 24;
  width: 300px;
  max-width: min(300px, calc(100vw - 20px));
  max-height: calc(100vh - 76px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d4d7dd;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.12);
  color: #111827;
  font-family: var(--ui-font);
}

.cost-reference.open {
  display: flex;
}

.cost-reference-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.cost-reference-header h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
}

.cost-reference-header p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.25;
}

.cost-reference-header strong {
  flex: 0 0 auto;
  color: #111827;
  font-size: 16px;
  line-height: 1.2;
}

.cost-reference-rows {
  overflow: auto;
  padding: 6px 0;
}

.cost-reference-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border-bottom: 1px solid #edf0f4;
  font-size: 12px;
  line-height: 1.35;
}

.cost-reference-row:last-child {
  border-bottom: 0;
}

.cost-reference-category {
  color: #374151;
  font-weight: 700;
}

.cost-reference-name {
  overflow: hidden;
  color: #111827;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cost-reference-price {
  color: #111827;
  font-weight: 700;
  cursor: text;
}

.cost-reference-input {
  width: 74px;
  height: 26px;
  border: 1px solid #1a73e8;
  border-radius: 4px;
  padding: 2px 5px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-weight: 700;
  text-align: right;
  outline: 0;
}

.cost-reference-row.missing .cost-reference-price,
.cost-reference-row.empty .cost-reference-price {
  color: #9ca3af;
  font-weight: 500;
}

.cost-reference-row.empty .cost-reference-price {
  cursor: default;
}

.cost-reference-row.missing .cost-reference-name,
.cost-reference-row.empty .cost-reference-name {
  color: #6b7280;
}

.suggestion-box {
  position: fixed;
  z-index: 180;
  display: none;
  max-height: 260px;
  max-width: calc(100vw - 12px);
  overflow: auto;
  border: 1px solid #7d8594;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.18);
  font-family: var(--ui-font);
  font-size: 13px;
}

.suggestion-box.open {
  display: block;
}

.suggestion-item {
  width: 100%;
  min-height: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: stretch;
  gap: 0;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  padding: 0;
  background: #ffffff;
  color: #111827;
  text-align: left;
  cursor: default;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-pick {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  border: 0;
  padding: 5px 4px 5px 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: default;
}

.suggestion-pick span {
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  word-break: break-word;
  line-height: 1.35;
}

.suggestion-pick strong {
  color: #374151;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.suggestion-item:hover {
  background: #eef2f7;
  color: #111827;
}

.suggestion-item:hover .suggestion-pick strong {
  color: #374151;
}

.suggestion-item.active,
.suggestion-item.active:hover {
  background: #1a73e8;
  color: #ffffff;
}

.suggestion-item.active .suggestion-pick strong,
.suggestion-item.active:hover .suggestion-pick strong {
  color: #ffffff;
}

.suggestion-delete-dot {
  position: relative;
  width: 24px;
  min-height: 32px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.suggestion-delete-dot::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  transform: translate(-50%, -50%);
}

.suggestion-delete-dot:hover::before {
  width: 8px;
  height: 8px;
  background: #dc2626;
}

.suggestion-item.active .suggestion-delete-dot::before {
  background: #ffffff;
}

.suggestion-item.active .suggestion-delete-dot:hover::before {
  background: #fecaca;
}

.database-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(860px, 100vw);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-left: 1px solid #d7dbe1;
  box-shadow: -16px 0 36px rgba(17, 24, 39, 0.16);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.database-drawer.open {
  transform: translateX(0);
}

.database-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #e5e7eb;
}

.database-header h2 {
  margin: 0;
  font-family: var(--ui-font);
  font-size: 18px;
  line-height: 1.25;
}

.database-header p {
  margin: 4px 0 0;
  color: #6b7280;
  font-family: var(--ui-font);
  font-size: 12px;
}

.database-header button,
.database-controls button,
.database-add button,
.database-footer button,
.database-table button {
  border: 1px solid #b8bec8;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  height: 30px;
  padding: 0 10px;
  font-family: var(--ui-font);
  cursor: pointer;
}

.database-controls,
.database-add {
  display: grid;
  gap: 8px;
  padding: 12px 14px 0;
}

.database-controls {
  grid-template-columns: 118px 1fr auto auto auto;
  align-items: center;
}

.database-controls button.active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.database-add {
  grid-template-columns: minmax(260px, 1fr) 88px 88px auto;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.database-controls select,
.database-controls input,
.database-add input,
.database-table input {
  min-height: 32px;
  border: 1px solid #b8bec8;
  border-radius: 6px;
  padding: 5px 8px;
  background: #ffffff;
  color: #111827;
  font-family: var(--ui-font);
}

.database-table-wrap {
  flex: 1;
  overflow: auto;
}

.database-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: var(--ui-font);
  font-size: 13px;
}

.database-table th,
.database-table td {
  border-bottom: 1px solid #edf0f4;
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.database-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
}

.database-table td:first-child,
.database-table th:first-child {
  min-width: 420px;
}

.database-table td:nth-child(2),
.database-table th:nth-child(2) {
  width: 94px;
}

.database-table td:nth-child(3),
.database-table th:nth-child(3) {
  width: 94px;
}

.database-table td:nth-child(4),
.database-table th:nth-child(4) {
  width: 218px;
  text-align: right;
}

.database-table.review-mode td:nth-child(2),
.database-table.review-mode th:nth-child(2) {
  width: 72px;
}

.database-table.review-mode td:nth-child(3),
.database-table.review-mode th:nth-child(3) {
  width: 190px;
}

.database-table.review-mode td:nth-child(4),
.database-table.review-mode th:nth-child(4) {
  width: 148px;
}

.database-table.openclaw-review-mode td:nth-child(2),
.database-table.openclaw-review-mode th:nth-child(2) {
  width: 148px;
}

.database-table.openclaw-review-mode td:nth-child(3),
.database-table.openclaw-review-mode th:nth-child(3) {
  width: 250px;
}

.database-table.openclaw-review-mode td:nth-child(4),
.database-table.openclaw-review-mode th:nth-child(4) {
  width: 210px;
}

.database-table input {
  width: 100%;
  min-width: 0;
}

.database-table input[data-db-name] {
  min-width: 360px;
  overflow-x: auto;
  white-space: nowrap;
  text-overflow: clip;
}

.duplicate-review-row .duplicate-review-name {
  font-weight: 700;
  line-height: 1.35;
}

.duplicate-review-row small {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.35;
}

.duplicate-review-candidates {
  display: grid;
  gap: 4px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.35;
}

.duplicate-review-candidates span {
  display: block;
}

.duplicate-review-candidates em {
  margin-left: 6px;
  color: #2563eb;
  font-style: normal;
}

.openclaw-review-name {
  font-weight: 700;
  line-height: 1.35;
}

.openclaw-review-meta,
.openclaw-review-sources,
.openclaw-review-issues {
  display: block;
  margin-top: 4px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.35;
}

.openclaw-review-decision {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 700;
}

.openclaw-review-candidates {
  display: grid;
  gap: 4px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.35;
}

.openclaw-image-review {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.openclaw-image-review span {
  display: grid;
  gap: 3px;
  width: 72px;
  color: #6b7280;
  font-size: 11px;
}

.openclaw-image-review img {
  width: 72px;
  height: 54px;
  object-fit: contain;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
}

.openclaw-review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.openclaw-review-actions button {
  margin: 0;
}

.database-footer {
  padding: 12px 14px;
  border-top: 1px solid #e5e7eb;
}

.cell {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--cell-text);
  font-family: var(--base-font);
  font-size: 11pt;
  line-height: 1.08;
  white-space: normal;
  word-break: break-word;
  background: #ffffff;
}

.cell.active {
  z-index: 4;
  box-shadow: inset 0 0 0 2px #1a73e8;
}

.cell.selected {
  z-index: 3;
  box-shadow: inset 0 0 0 1px rgba(26, 115, 232, 0.85);
}

.cell.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(26, 115, 232, 0.12);
  pointer-events: none;
}

.cell.selection-anchor {
  box-shadow: inset 0 0 0 2px #1a73e8;
}

.cell.blank {
  background: #ffffff;
}

.cell.top-title,
.cell.date-cell,
.cell.address {
  background: var(--cell-dark);
  color: #d8d8d8;
  font-weight: 700;
}

.cell.top-title {
  justify-content: center;
  align-items: center;
  padding: 0 6px;
  font-family: var(--price-font);
  font-size: 16pt;
}

.title-lockup {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.config-title-image {
  width: auto;
  max-width: 100%;
  height: 48px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
}

.title-copy {
  position: absolute;
  left: 0;
  top: 0;
  width: 116px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d8d8d8;
  font-family: var(--price-font);
  font-size: 9pt;
  line-height: 1;
  font-weight: 700;
  text-align: center;
}

.title-lockup span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell.date-cell {
  z-index: 1;
  font-family: var(--price-font);
  font-size: 12pt;
}

.cell.address {
  font-size: 17pt;
  color: #ffffff;
  font-family: var(--price-font);
  font-weight: 400;
  overflow: hidden;
  padding: 0 10px;
}

.address-flip {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 700px;
}

.address-flip span {
  display: block;
  min-width: 100%;
  line-height: 1.08;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform-origin: center center;
  will-change: transform;
}

.cell.address.flipping .address-flip span {
  animation: address-flip 520ms ease both;
}

.item-free-edit-input {
  background: #fffef2 !important;
  box-shadow: inset 0 0 0 2px #f59e0b;
}

@keyframes address-flip {
  0% {
    opacity: 0;
    transform: rotateX(82deg) translateY(-8px);
  }
  55% {
    opacity: 1;
    transform: rotateX(-10deg) translateY(1px);
  }
  100% {
    opacity: 1;
    transform: rotateX(0deg) translateY(0);
  }
}

.cell.label {
  font-size: 18pt;
  font-family: var(--label-font);
}

.cell.label.gray,
.cell.item.gray,
.cell.price.gray {
  background: var(--cell-light);
}

.cell.label.dim,
.cell.item.dim,
.cell.price.dim {
  background: var(--cell-dim);
}

.cell.label.dark {
  background: var(--cell-mid);
  color: var(--cell-yellow);
}

.cell.label.black {
  background: var(--cell-dark);
  color: #d8d8d8;
  font-family: var(--price-font);
  font-weight: 400;
  font-size: 18pt;
}

.cell.item,
.cell.price {
  font-family: var(--item-font);
}

.cell.item {
  font-size: 14pt;
  padding: 0 6px;
}

.cell.price {
  font-family: var(--price-font);
  font-size: 16pt;
}

.cell.total-desc,
.cell.total-price {
  background: var(--cell-dark);
  color: #d8d8d8;
  font-family: var(--price-font);
  font-size: 16pt;
}

.cell.total-price {
  background: var(--cell-mid);
  font-size: 18pt;
}

.cell.quote-value {
  background: var(--cell-dark);
  color: var(--cell-yellow);
  padding: 0;
}

.cell.quote-value .sheet-input {
  color: var(--cell-yellow);
  font-size: 36pt;
  font-family: var(--label-font);
  line-height: 0.92;
  padding: 0 4px;
}

.cell.small-result {
  font-weight: 700;
}

.cell.modify button {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: inherit;
  font-family: var(--base-font);
  font-size: 11pt;
  line-height: 1;
  white-space: normal;
  cursor: pointer;
}

.modify.red {
  color: #ff0000;
}

.modify.blue {
  color: #00b0f0;
}

.modify.purple {
  color: #7030a0;
}

.package-cell {
  background: var(--cell-orange);
  font-family: var(--price-font);
}

.sheet-input,
.sheet-select {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 5px;
  background: transparent;
  color: inherit;
  text-align: center;
  font: inherit;
  line-height: inherit;
  user-select: text;
}

.item .sheet-input {
  font-size: 14pt;
}

.cell.item.name-scroll-active .sheet-input {
  color: transparent;
  caret-color: transparent;
}

.name-scroll-overlay {
  position: absolute;
  left: 6px;
  top: 50%;
  z-index: 3;
  display: block;
  width: max-content;
  min-width: max-content;
  max-width: none;
  color: inherit;
  font: inherit;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%);
  animation: item-name-auto-scroll var(--name-scroll-duration, 6s) ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes item-name-auto-scroll {
  0%,
  16% {
    transform: translate(0, -50%);
  }

  84%,
  100% {
    transform: translate(calc(-1 * var(--name-scroll-distance, 0px)), -50%);
  }
}

.price .sheet-input {
  font-size: 16pt;
}

.cell.price [data-price-index] {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: cell;
}

.price-edit-input {
  background: rgba(255, 255, 255, 0.28);
  cursor: text;
}

.service-rate-edit-input {
  width: calc(100% - 14px);
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 4px;
  outline: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font: inherit;
  text-align: center;
}

.service-rate-edit-input::selection {
  background: #1a73e8;
  color: #ffffff;
}

.package-cell .sheet-input {
  padding: 0 1px;
  font-size: 12pt;
  font-weight: 700;
}

.sheet-input:focus {
  background: rgba(255, 255, 255, 0.18);
}

.sheet-input::selection {
  background: #1a73e8;
  color: #ffffff;
}

.side-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100vh - 92px);
}

.panel-block {
  background: var(--panel);
  border: 1px solid #d8dde5;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-block label {
  font-size: 13px;
  color: #374151;
  font-weight: 650;
}

.panel-block input,
.panel-block select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #b8bec8;
  border-radius: 6px;
  padding: 6px 8px;
  background: #ffffff;
  color: #111827;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.totals {
  gap: 10px;
}

.totals div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.totals span {
  color: var(--muted);
}

.totals strong {
  font-size: 16px;
  color: #111827;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: #ffffff;
  padding: 10px 13px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.22);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.address-manager {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.28);
  font-family: var(--ui-font);
}

.address-manager-card {
  width: min(560px, calc(100vw - 36px));
  max-height: min(640px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d6dce6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 46px rgba(17, 24, 39, 0.22);
}

.address-manager-card header,
.address-manager-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.address-manager-card footer {
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
  border-bottom: 0;
}

.address-manager-card h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.address-manager-card button {
  min-height: 30px;
  border: 1px solid #b8bec8;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  padding: 0 10px;
  font: inherit;
  cursor: pointer;
}

.address-manager-card button[data-address-save] {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #ffffff;
}

.address-message-list {
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.address-message-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.address-message-row textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  border: 1px solid #b8bec8;
  border-radius: 6px;
  padding: 7px 8px;
  color: #111827;
  background: #ffffff;
  font: inherit;
  line-height: 1.45;
  user-select: text;
}

.customer-mode .small-result,
.customer-mode .package-cell .sheet-input,
.customer-mode .price span,
.customer-mode .price input,
.customer-mode .total-desc,
.customer-mode .total-price {
  visibility: hidden;
}

.customer-mode .package-cell,
.customer-mode .cell.price,
.customer-mode .cell.total-price {
  background: #ffffff;
}

.customer-mode .cell.total-desc {
  background: var(--cell-dark);
}

.customer-mode .cost-reference {
  display: none;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) 156px;
  }

  .merchant-tools {
    width: 146px;
    max-width: 146px;
    margin: 8px 8px 0 0;
  }

  .cost-popover {
    top: 8px;
    right: 164px;
    bottom: auto;
  }

  .cost-reference {
    top: 8px;
    right: 164px;
    bottom: auto;
    width: min(300px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sheet-stage {
    padding: 8px;
    padding-bottom: 156px;
    min-height: auto;
  }

  .merchant-tools {
    position: fixed;
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    margin: 0;
    justify-content: space-between;
  }

  .config-switcher {
    flex-direction: row;
    flex-wrap: wrap;
    padding-right: 0;
    padding-bottom: 6px;
    border-right: 0;
    border-bottom: 1px solid #d8dde5;
  }

  .config-switcher select {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .config-switcher button {
    flex: 1 1 0;
  }

  .merchant-action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .merchant-action-grid button {
    padding: 0 4px;
  }

  .database-add {
    grid-template-columns: 1fr;
  }

  .cost-popover {
    top: auto;
    right: 8px;
    bottom: 156px;
  }

  .cost-reference {
    top: auto;
    right: 8px;
    bottom: 156px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 172px);
  }
}

@media (max-width: 520px) {
  .sheet-stage {
    padding-bottom: 216px;
  }

  .merchant-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cost-popover {
    bottom: 216px;
  }

  .cost-reference {
    bottom: 216px;
    max-height: calc(100vh - 232px);
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .side-panel,
  .suggestion-box,
  .cost-popover,
  .cost-reference,
  .merchant-tools {
    display: none;
  }

  .workspace,
  .sheet-stage {
    display: block;
    padding: 0;
    border: 0;
    background: #ffffff;
    min-height: auto;
  }

  .excel-sheet {
    box-shadow: none;
    transform: none;
  }
}

/* Product Tooltip */
.product-tooltip {
  position: fixed;
  z-index: 100;
  max-width: 320px;
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 12px;
  background: #111827;
  color: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--ui-font);
}

.product-tooltip.show {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
}

/* Tooltip Image Styles */
.tooltip-image-container {
  width: 100%;
  margin-bottom: 10px;
  background-color: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
}

.tooltip-image {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  display: block;
}

.tooltip-text {
  color: #f3f4f6;
  white-space: pre-wrap;
  word-break: break-word;
}

.tooltip-spec-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
  margin-bottom: 10px;
  color: #f3f4f6;
  white-space: normal;
}

.tooltip-spec-grid dt {
  color: #9ca3af;
  font-weight: 700;
}

.tooltip-spec-grid dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.tooltip-search-links {
  display: grid;
  grid-template-columns: repeat(4, 16px);
  justify-content: end;
  gap: 8px;
  margin-top: 10px;
}

.tooltip-search-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  color: transparent;
  font-size: 0;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.tooltip-search-link:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.tooltip-search-link.douyin {
  background:
    radial-gradient(circle at 36% 36%, #ffffff 0 13%, transparent 14%),
    linear-gradient(135deg, #00f2ea 0 34%, #111111 35% 64%, #ff0050 65% 100%);
  box-shadow:
    -1px 0 0 #00f2ea,
    1px 0 0 #ff0050,
    0 0 0 1px rgba(255, 255, 255, 0.22);
}

.tooltip-search-link.jd {
  background: #e1251b;
}

.tooltip-search-link.pdd {
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.28);
}

.tooltip-search-link.taobao {
  background: #ff6a00;
}

.tooltip-image-refresh {
  border: 0;
  border-radius: 4px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

.tooltip-image-refresh:hover {
  background: rgba(255, 255, 255, 0.24);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(245, 247, 250, 0.92);
  backdrop-filter: blur(8px);
  font-family: var(--ui-font);
}

.auth-card {
  width: min(360px, 100%);
  padding: 22px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.auth-card h1 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

.auth-card label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #4b5563;
}

.auth-card input {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  color: #111827;
  background: #ffffff;
}

.auth-card input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.22);
  border-color: #2563eb;
}

.auth-card button {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.auth-card button:disabled {
  opacity: 0.55;
  cursor: default;
}

.auth-message {
  min-height: 18px;
  margin: 0 0 12px;
  color: #dc2626;
  font-size: 12px;
}

.user-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  height: 28px;
  padding: 0 4px 0 10px;
  border: 1px solid #d6dce6;
  border-radius: 6px;
  background: #ffffff;
  color: #4b5563;
  font-size: 12px;
}

.user-session span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-session button {
  height: 22px;
  border: 1px solid #d6dce6;
  border-radius: 5px;
  padding: 0 8px;
  background: #f8fafc;
  color: #111827;
  font: inherit;
  cursor: pointer;
}

.product-readonly .database-add,
.product-readonly .database-table th:nth-child(3),
.product-readonly .database-table td:nth-child(3),
.product-readonly #costReference {
  display: none;
}

.product-readonly .database-table input:disabled,
.product-readonly .database-table button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
