:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --sidebar: #111827;
  --sidebar-soft: #1f2937;
  --text: #172033;
  --muted: #697386;
  --muted-2: #94a3b8;
  --line: #e4e9f1;
  --line-strong: #d5dce7;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eef2ff;
  --green: #0f9f6e;
  --green-soft: #e8f8f2;
  --amber: #d97706;
  --amber-soft: #fff7e6;
  --red: #dc2626;
  --red-soft: #fff1f2;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 26px 80px rgba(15, 23, 42, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
}

/* 新品提报：完整详情与原图预览 */
body[data-admin-surface="product"] .new-test-avatar-button {
  position: relative;
  margin: 0;
  padding: 0;
  appearance: none;
  cursor: zoom-in;
  font: inherit;
}

body[data-admin-surface="product"] .new-test-avatar-button:hover {
  border-color: rgba(0, 113, 227, .42);
  box-shadow: 0 8px 20px rgba(0, 113, 227, .14);
  transform: translateY(-1px);
}

body[data-admin-surface="product"] .new-test-avatar-button:focus-visible,
body[data-admin-surface="product"] .new-test-detail-photo-button:focus-visible,
body[data-admin-surface="product"] .new-test-image-close:focus-visible {
  outline: 3px solid rgba(0, 113, 227, .28);
  outline-offset: 3px;
}

body[data-admin-surface="product"] .new-test-avatar-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

body[data-admin-surface="product"] .new-test-avatar.has-image .new-test-avatar-placeholder {
  display: none;
}

body[data-admin-surface="product"] .new-test-avatar-zoom {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #fff;
  background: rgba(15, 23, 42, .76);
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 160ms ease, transform 160ms ease;
}

body[data-admin-surface="product"] .new-test-avatar-button:hover .new-test-avatar-zoom,
body[data-admin-surface="product"] .new-test-avatar-button:focus-visible .new-test-avatar-zoom {
  opacity: 1;
  transform: translateY(0);
}

body[data-admin-surface="product"] .modal.new-test-detail-modal {
  width: min(96vw, 1180px);
  max-height: min(94vh, 960px);
  border-radius: 24px;
}

body[data-admin-surface="product"] .modal-header.new-test-detail-modal-header,
body[data-admin-surface="product"] .modal-footer.new-test-detail-modal-footer {
  flex: 0 0 auto;
  padding: 15px 20px;
}

body[data-admin-surface="product"] .modal-header.new-test-detail-modal-header h2 {
  font-size: 20px;
}

body[data-admin-surface="product"] .modal-body.new-test-detail-modal-body {
  padding: 18px;
  background: #f5f7fb;
}

body[data-admin-surface="product"] .new-test-detail-content {
  display: grid;
  gap: 14px;
}

body[data-admin-surface="product"] .new-test-detail-hero {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
  padding: 15px;
  color: #fff;
  background: linear-gradient(135deg, #0b5fb5 0%, #0071e3 58%, #238cf2 100%);
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(0, 113, 227, .16);
}

body[data-admin-surface="product"] .new-test-detail-photo-button,
body[data-admin-surface="product"] .new-test-detail-photo-empty {
  position: relative;
  display: grid;
  width: 176px;
  min-height: 132px;
  margin: 0;
  padding: 0;
  place-items: center;
  overflow: hidden;
  color: rgba(255, 255, 255, .88);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .27);
  border-radius: 14px;
}

body[data-admin-surface="product"] .new-test-detail-photo-button {
  appearance: none;
  cursor: zoom-in;
}

body[data-admin-surface="product"] .new-test-detail-photo-button img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-admin-surface="product"] .new-test-detail-photo-placeholder {
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-detail-photo-button.has-image .new-test-detail-photo-placeholder {
  display: none;
}

body[data-admin-surface="product"] .new-test-detail-photo-zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  padding: 5px 9px;
  color: #fff;
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

body[data-admin-surface="product"] .new-test-detail-photo-empty {
  align-content: center;
  gap: 5px;
}

body[data-admin-surface="product"] .new-test-detail-photo-empty span {
  font-size: 30px;
  font-weight: 760;
}

body[data-admin-surface="product"] .new-test-detail-photo-empty small {
  font-size: 10px;
}

body[data-admin-surface="product"] .new-test-detail-identity {
  display: grid;
  align-content: center;
  min-width: 0;
}

body[data-admin-surface="product"] .new-test-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

body[data-admin-surface="product"] .new-test-detail-title-row > div > span {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, .75);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .08em;
}

body[data-admin-surface="product"] .new-test-detail-title-row h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.2;
}

body[data-admin-surface="product"] .new-test-detail-title-row .status-badge {
  color: #064b8e;
  background: rgba(255, 255, 255, .9);
  border-color: rgba(255, 255, 255, .7);
}

body[data-admin-surface="product"] .new-test-detail-identity > p {
  margin: 8px 0 16px;
  color: rgba(255, 255, 255, .78);
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-detail-progress {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
  gap: 7px 12px;
}

body[data-admin-surface="product"] .new-test-detail-progress span {
  font-size: 11px;
}

body[data-admin-surface="product"] .new-test-detail-progress strong {
  font-size: 15px;
}

body[data-admin-surface="product"] .new-test-detail-progress i {
  grid-column: 1 / -1;
  display: block;
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, .2);
  border-radius: 999px;
}

body[data-admin-surface="product"] .new-test-detail-progress em {
  display: block;
  height: 100%;
  background: #fff;
  border-radius: inherit;
}

body[data-admin-surface="product"] .new-test-detail-section {
  min-width: 0;
  padding: 16px;
  background: #fff;
  border: 1px solid rgba(16, 24, 40, .09);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .035);
}

body[data-admin-surface="product"] .new-test-detail-section-heading > span,
body[data-admin-surface="product"] .new-test-detail-section-heading > div > span {
  display: block;
  color: #0071e3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

body[data-admin-surface="product"] .new-test-detail-section-heading h3 {
  margin: 2px 0 11px;
  color: #1d1d1f;
  font-size: 15px;
}

body[data-admin-surface="product"] .new-test-detail-section-heading-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body[data-admin-surface="product"] .new-test-detail-section-heading-inline b {
  padding: 5px 9px;
  color: #56606f;
  background: #f2f4f7;
  border-radius: 999px;
  font-size: 10px;
}

body[data-admin-surface="product"] .new-test-detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, .08);
  border-radius: 12px;
}

body[data-admin-surface="product"] .new-test-detail-summary-grid > div {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 10px 12px;
  border-top: 1px solid rgba(16, 24, 40, .08);
  border-left: 1px solid rgba(16, 24, 40, .08);
}

body[data-admin-surface="product"] .new-test-detail-summary-grid > div:nth-child(-n + 3) {
  border-top: 0;
}

body[data-admin-surface="product"] .new-test-detail-summary-grid > div:nth-child(3n + 1) {
  border-left: 0;
}

body[data-admin-surface="product"] .new-test-detail-summary-grid span,
body[data-admin-surface="product"] .new-test-detail-supplement span,
body[data-admin-surface="product"] .new-test-detail-note > span {
  color: #6e6e73;
  font-size: 10px;
}

body[data-admin-surface="product"] .new-test-detail-summary-grid strong,
body[data-admin-surface="product"] .new-test-detail-supplement strong {
  overflow-wrap: anywhere;
  color: #1d1d1f;
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-detail-recipe {
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, .09);
  border-radius: 12px;
}

body[data-admin-surface="product"] .new-test-detail-item {
  display: grid;
  grid-template-columns: 44px 120px minmax(150px, 1.3fr) 110px minmax(140px, 1fr);
  align-items: center;
  min-width: 0;
  border-top: 1px solid rgba(16, 24, 40, .08);
}

body[data-admin-surface="product"] .new-test-detail-item:first-child {
  border-top: 0;
}

body[data-admin-surface="product"] .new-test-detail-item > * {
  min-width: 0;
  padding: 9px 11px;
  overflow-wrap: anywhere;
  color: #4d5562;
  border-left: 1px solid rgba(16, 24, 40, .08);
  font-size: 11px;
}

body[data-admin-surface="product"] .new-test-detail-item > *:first-child {
  border-left: 0;
}

body[data-admin-surface="product"] .new-test-detail-item strong {
  color: #1d1d1f;
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-detail-item-header {
  background: #f5f7fa;
}

body[data-admin-surface="product"] .new-test-detail-item-header > * {
  color: #6e6e73;
  font-size: 9px;
  font-weight: 760;
}

body[data-admin-surface="product"] .new-test-detail-item-index {
  color: #0071e3;
  font-weight: 760;
  text-align: center;
}

body[data-admin-surface="product"] .new-test-detail-empty {
  padding: 18px;
  color: #8b8f97;
  font-size: 11px;
  text-align: center;
}

body[data-admin-surface="product"] .new-test-detail-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

body[data-admin-surface="product"] .new-test-detail-long-copy,
body[data-admin-surface="product"] .new-test-detail-note p,
body[data-admin-surface="product"] .new-test-detail-review p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #373b43;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
}

body[data-admin-surface="product"] .new-test-detail-long-copy.is-empty,
body[data-admin-surface="product"] .new-test-detail-note p.is-empty {
  color: #9a9da3;
}

body[data-admin-surface="product"] .new-test-detail-supplement {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, .08);
  border-radius: 11px;
}

body[data-admin-surface="product"] .new-test-detail-supplement > div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 1px solid rgba(16, 24, 40, .08);
}

body[data-admin-surface="product"] .new-test-detail-supplement > div:first-child {
  border-left: 0;
}

body[data-admin-surface="product"] .new-test-detail-note {
  margin-top: 11px;
  padding: 10px 12px;
  background: #f7f8fa;
  border-radius: 11px;
}

body[data-admin-surface="product"] .new-test-detail-note > span {
  display: block;
  margin-bottom: 4px;
}

body[data-admin-surface="product"] .new-test-detail-review {
  color: #8a3b35;
  background: #fff8f7;
  border-color: rgba(217, 45, 32, .15);
}

body[data-admin-surface="product"] .new-test-detail-timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  overflow: hidden;
  background: rgba(16, 24, 40, .08);
  border: 1px solid rgba(16, 24, 40, .08);
  border-radius: 13px;
}

body[data-admin-surface="product"] .new-test-detail-timeline > div {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  background: #fff;
}

body[data-admin-surface="product"] .new-test-detail-timeline span {
  color: #7a7f88;
  font-size: 9px;
}

body[data-admin-surface="product"] .new-test-detail-timeline time,
body[data-admin-surface="product"] .new-test-detail-timeline strong {
  color: #30343b;
  font-size: 10px;
  font-weight: 700;
}

body[data-admin-surface="product"] .modal-backdrop.new-test-image-backdrop {
  z-index: calc(var(--ui-z-backdrop, 200) + 20);
  padding: 18px;
  background: rgba(4, 9, 18, .88);
  backdrop-filter: blur(16px);
}

body[data-admin-surface="product"] .modal.new-test-image-modal {
  width: min(96vw, 1280px);
  height: min(94vh, 980px);
  max-height: none;
  color: #fff;
  background: #090d14;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 20px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .48);
}

body[data-admin-surface="product"] .new-test-image-modal-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

body[data-admin-surface="product"] .new-test-image-modal-header h2 {
  margin: 0;
  color: #fff;
  font-size: 16px;
}

body[data-admin-surface="product"] .new-test-image-modal-header p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, .55);
  font-size: 10px;
}

body[data-admin-surface="product"] .new-test-image-close {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  cursor: pointer;
  font-size: 23px;
  line-height: 1;
}

body[data-admin-surface="product"] .new-test-image-stage {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  place-items: center;
  overflow: hidden;
}

body[data-admin-surface="product"] .new-test-image-stage img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

body[data-admin-surface="product"] .new-test-image-status {
  padding: 12px 16px;
  color: rgba(255, 255, 255, .72);
  background: rgba(255, 255, 255, .08);
  border-radius: 12px;
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-image-status[data-state="error"] {
  color: #ffd1cc;
  background: rgba(217, 45, 32, .16);
}

@media (max-width: 720px) {
  body[data-admin-surface="product"] .new-test-avatar-zoom {
    opacity: 1;
    transform: none;
  }

  body[data-admin-surface="product"] .modal.new-test-detail-modal {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  body[data-admin-surface="product"] .modal-header.new-test-detail-modal-header,
  body[data-admin-surface="product"] .modal-footer.new-test-detail-modal-footer {
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }

  body[data-admin-surface="product"] .modal-footer.new-test-detail-modal-footer .modal-hint {
    display: none;
  }

  body[data-admin-surface="product"] .modal-footer.new-test-detail-modal-footer .button {
    width: 100%;
  }

  body[data-admin-surface="product"] .modal-body.new-test-detail-modal-body {
    padding: 12px;
  }

  body[data-admin-surface="product"] .new-test-detail-hero {
    grid-template-columns: 106px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  body[data-admin-surface="product"] .new-test-detail-photo-button,
  body[data-admin-surface="product"] .new-test-detail-photo-empty {
    width: 106px;
    min-height: 106px;
  }

  body[data-admin-surface="product"] .new-test-detail-photo-zoom {
    right: 6px;
    bottom: 6px;
    padding: 4px 7px;
  }

  body[data-admin-surface="product"] .new-test-detail-title-row {
    display: grid;
    gap: 7px;
  }

  body[data-admin-surface="product"] .new-test-detail-title-row h3 {
    font-size: 20px;
  }

  body[data-admin-surface="product"] .new-test-detail-identity > p {
    margin: 5px 0 10px;
  }

  body[data-admin-surface="product"] .new-test-detail-summary-grid,
  body[data-admin-surface="product"] .new-test-detail-two-columns {
    grid-template-columns: 1fr;
  }

  body[data-admin-surface="product"] .new-test-detail-summary-grid > div:nth-child(n) {
    border-top: 1px solid rgba(16, 24, 40, .08);
    border-left: 0;
  }

  body[data-admin-surface="product"] .new-test-detail-summary-grid > div:first-child {
    border-top: 0;
  }

  body[data-admin-surface="product"] .new-test-detail-item-header {
    display: none;
  }

  body[data-admin-surface="product"] .new-test-detail-item {
    grid-template-columns: 34px minmax(0, 1fr) minmax(0, .8fr);
    gap: 0;
    padding: 9px 10px;
  }

  body[data-admin-surface="product"] .new-test-detail-item > * {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    padding: 5px 7px;
    border-left: 0;
  }

  body[data-admin-surface="product"] .new-test-detail-item > *[data-label]::before {
    color: #8a8f97;
    content: attr(data-label);
    font-size: 9px;
    font-weight: 650;
  }

  body[data-admin-surface="product"] .new-test-detail-item-index {
    grid-row: 1 / span 2;
    align-self: stretch;
    display: grid;
    place-items: start center;
    padding-top: 7px;
  }

  body[data-admin-surface="product"] .new-test-detail-item > *:nth-child(4),
  body[data-admin-surface="product"] .new-test-detail-item > *:nth-child(5) {
    grid-column: 2 / -1;
  }

  body[data-admin-surface="product"] .modal-backdrop.new-test-image-backdrop {
    padding: 0;
  }

  body[data-admin-surface="product"] .modal.new-test-image-modal {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  body[data-admin-surface="product"] .new-test-image-modal-header {
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  }

  body[data-admin-surface="product"] .new-test-image-stage {
    padding: 10px;
  }
}

/* New product test workspace · unified cost-center design (2026-07-13) */
body[data-admin-surface="product"] .new-test-mobile-action {
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-mobile-action[hidden] {
  display: none !important;
}

body[data-admin-surface="product"] .new-test-entry-page {
  display: grid;
  gap: 14px;
  min-width: 0;
}

body[data-admin-surface="product"] .new-test-entry-page-guide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 16px 18px;
  color: var(--ui-text, #1d1d1f);
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 16px;
  box-shadow: var(--ui-shadow-sm, 0 2px 8px rgba(16, 24, 40, .06));
}

body[data-admin-surface="product"] .new-test-entry-page-guide > div:first-child {
  min-width: 0;
}

body[data-admin-surface="product"] .new-test-entry-page-guide h2 {
  margin: 4px 0 4px;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -.025em;
}

body[data-admin-surface="product"] .new-test-entry-page-guide p {
  max-width: 720px;
  margin: 0;
  color: var(--ui-muted, #6e6e73);
  font-size: 12px;
  line-height: 1.6;
}

body[data-admin-surface="product"] .new-test-entry-guide-points {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

body[data-admin-surface="product"] .new-test-entry-guide-points span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--ui-text-2, #3a3a3c);
  background: var(--ui-surface-2, #f7f8fa);
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 999px;
  font-size: 11px;
  font-weight: 680;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-entry-guide-points span::before {
  width: 6px;
  height: 6px;
  background: var(--ui-blue, #0071e3);
  border-radius: 50%;
  content: "";
}

body[data-admin-surface="product"] .new-test-entry-page .new-test-entry-frame {
  position: relative;
  height: max(720px, calc(100dvh - 250px));
  min-width: 0;
  min-height: 720px;
  overflow: hidden;
  background: var(--ui-bg, #f5f5f7);
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 18px;
  box-shadow: var(--ui-shadow-sm, 0 2px 8px rgba(16, 24, 40, .06));
}

body[data-admin-surface="product"] .new-test-entry-page .new-test-entry-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Desktop entry is a single-screen workspace. The title bar already explains
 * the task, so the repeated guide is removed and the form receives the whole
 * remaining viewport without creating a second page or iframe scrollbar.
 */
@media (min-width: 1200px) {
  body[data-admin-surface="product"].new-product-entry-active {
    overflow: hidden;
  }

  body[data-admin-surface="product"].new-product-entry-active .workspace {
    height: 100dvh;
    overflow: hidden;
  }

  body[data-admin-surface="product"].new-product-entry-active .topbar {
    min-height: 78px;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  body[data-admin-surface="product"].new-product-entry-active .content {
    height: calc(100dvh - 78px);
    padding-top: 10px;
    padding-bottom: 12px;
    overflow: hidden;
  }

  body[data-admin-surface="product"].new-product-entry-active #newProductEntryView,
  body[data-admin-surface="product"].new-product-entry-active .new-test-entry-page {
    height: 100%;
    min-height: 0;
  }

  body[data-admin-surface="product"].new-product-entry-active .new-test-entry-page-guide {
    display: none;
  }

  body[data-admin-surface="product"].new-product-entry-active .new-test-entry-page .new-test-entry-frame {
    height: 100%;
    min-height: 0;
    border-radius: 16px;
  }
}

body[data-admin-surface="product"] #newProductTestsView .new-test-metrics {
  margin-top: 0;
}

body[data-admin-surface="product"] .new-test-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.2fr);
  align-items: center;
  gap: 28px;
  min-height: 0;
  padding: 20px 22px;
  overflow: hidden;
  color: var(--ui-text, #1d1d1f);
  background:
    radial-gradient(circle at 92% 6%, rgba(0, 113, 227, .09), transparent 28%),
    var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 18px;
  box-shadow: var(--ui-shadow-sm, 0 2px 8px rgba(16, 24, 40, .06));
}

body[data-admin-surface="product"] .new-test-hero::before,
body[data-admin-surface="product"] .new-test-hero::after {
  display: none;
}

body[data-admin-surface="product"] .new-test-hero-copy {
  position: relative;
  z-index: 1;
}

body[data-admin-surface="product"] .new-test-hero h2 {
  margin: 5px 0 5px;
  max-width: none;
  color: var(--ui-text, #1d1d1f);
  font-size: clamp(20px, 1.8vw, 27px);
  line-height: 1.18;
  letter-spacing: -.035em;
}

body[data-admin-surface="product"] .new-test-hero p {
  max-width: 560px;
  margin: 0;
  color: var(--ui-muted, #6e6e73);
  font-size: 13px;
  line-height: 1.65;
}

body[data-admin-surface="product"] .new-test-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body[data-admin-surface="product"] .new-test-flow li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  color: var(--ui-text, #1d1d1f);
  background: rgba(0, 113, 227, .045);
  border: 1px solid rgba(0, 113, 227, .12);
  border-radius: 13px;
}

body[data-admin-surface="product"] .new-test-flow b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ui-blue, #0071e3);
  background: rgba(0, 113, 227, .1);
  border-radius: 10px;
  font-size: 11px;
}

body[data-admin-surface="product"] .new-test-flow span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

body[data-admin-surface="product"] .new-test-flow strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-flow small {
  overflow: hidden;
  color: var(--ui-muted, #6e6e73);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric {
  position: relative;
  min-height: 88px;
  padding: 16px 18px;
  overflow: hidden;
  text-align: left;
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 16px;
  box-shadow: var(--ui-shadow-sm, 0 2px 8px rgba(16, 24, 40, .06));
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
  content: "";
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric:hover {
  border-color: rgba(0, 113, 227, .28);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .08);
  transform: translateY(-1px);
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric.active {
  background: rgba(0, 113, 227, .055);
  border-color: rgba(0, 113, 227, .36);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .07);
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric.active::before {
  background: var(--ui-blue, #0071e3);
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric span {
  color: var(--ui-muted, #6e6e73);
  font-size: 12px;
  font-weight: 650;
}

body[data-admin-surface="product"] .new-test-metrics .mini-metric strong {
  margin-top: 5px;
  color: var(--ui-text, #1d1d1f);
  font-size: 28px;
  line-height: 1;
}

body[data-admin-surface="product"] .new-test-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 14px;
}

body[data-admin-surface="product"] .new-test-inbox {
  padding: 0;
  overflow: hidden;
}

body[data-admin-surface="product"] .new-test-inbox > .panel-heading {
  margin: 0;
  padding: 17px 20px;
  border-bottom: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
}

body[data-admin-surface="product"] .new-test-inbox-heading p {
  max-width: 720px;
  margin: 5px 0 0;
  color: var(--ui-muted, #6e6e73);
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-inbox-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ui-muted, #6e6e73);
  font-size: 12px;
}

body[data-admin-surface="product"] .new-test-inbox-summary strong {
  color: var(--ui-text, #1d1d1f);
  font-size: 16px;
}

body[data-admin-surface="product"] .new-test-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) auto;
  gap: 10px;
  align-items: center;
  margin: 0;
  padding: 13px 20px;
  background: var(--ui-subtle, #fbfbfd);
  border-bottom: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
}

body[data-admin-surface="product"] .new-test-list {
  display: grid;
  gap: 12px;
  padding: 16px 20px 20px;
}

body[data-admin-surface="product"] .new-test-card {
  display: grid;
  grid-template-columns: minmax(255px, .8fr) minmax(420px, 1.4fr) auto;
  grid-template-areas:
    "head details note"
    "head foot foot";
  align-items: center;
  gap: 12px 18px;
  min-height: 142px;
  padding: 15px 16px;
  color: var(--ui-text, #1d1d1f);
  background: var(--ui-surface, #fff);
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 15px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .035);
}

body[data-admin-surface="product"] .new-test-card[aria-busy="true"] {
  opacity: .72;
  pointer-events: none;
}

body[data-admin-surface="product"] .new-test-card-head {
  grid-area: head;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-areas: "avatar copy" "avatar status";
  align-items: center;
  gap: 5px 13px;
  min-width: 0;
}

body[data-admin-surface="product"] .new-test-avatar {
  grid-area: avatar;
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  overflow: hidden;
  color: var(--ui-blue, #0071e3);
  background: rgba(0, 113, 227, .09);
  border: 1px solid rgba(0, 113, 227, .13);
  border-radius: 14px;
  font-size: 21px;
  font-weight: 760;
}

body[data-admin-surface="product"] .new-test-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-admin-surface="product"] .new-test-card-copy {
  grid-area: copy;
  min-width: 0;
}

body[data-admin-surface="product"] .new-test-card-kicker {
  display: block;
  overflow: hidden;
  color: var(--ui-blue, #0071e3);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-card-copy h4 {
  margin: 2px 0;
  overflow: hidden;
  color: var(--ui-text, #1d1d1f);
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-card-copy p {
  margin: 0;
  overflow: hidden;
  color: var(--ui-muted, #6e6e73);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-card-head > .status-badge {
  grid-area: status;
  justify-self: start;
}

body[data-admin-surface="product"] .new-test-card-details {
  grid-area: details;
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr)) minmax(150px, 1.15fr);
  align-items: center;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  border-radius: 12px;
}

body[data-admin-surface="product"] .new-test-card-details > div {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 61px;
  padding: 9px 12px;
  border-left: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
}

body[data-admin-surface="product"] .new-test-card-details > div:first-child {
  border-left: 0;
}

body[data-admin-surface="product"] .new-test-card-details span {
  overflow: hidden;
  color: var(--ui-muted, #6e6e73);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-card-details strong {
  margin-top: 3px;
  overflow: hidden;
  color: var(--ui-text, #1d1d1f);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-progress span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

body[data-admin-surface="product"] .new-test-progress b {
  color: var(--ui-blue, #0071e3);
}

body[data-admin-surface="product"] .new-test-progress i {
  display: block;
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  background: rgba(0, 113, 227, .1);
  border-radius: 999px;
}

body[data-admin-surface="product"] .new-test-progress em {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0a84ff, #0071e3);
  border-radius: inherit;
}

body[data-admin-surface="product"] .new-test-review-note {
  grid-area: note;
  width: min(210px, 16vw);
  margin: 0;
  padding: 9px 11px;
  color: #8a3b35;
  background: rgba(217, 45, 32, .07);
  border: 1px solid rgba(217, 45, 32, .14);
  border-radius: 11px;
}

body[data-admin-surface="product"] .new-test-review-note strong {
  display: block;
  margin-bottom: 2px;
  font-size: 10px;
}

body[data-admin-surface="product"] .new-test-review-note p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body[data-admin-surface="product"] .new-test-card-foot {
  grid-area: foot;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

body[data-admin-surface="product"] .new-test-card-foot small {
  color: var(--ui-muted, #6e6e73);
  font-size: 10px;
  white-space: nowrap;
}

body[data-admin-surface="product"] .new-test-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

body[data-admin-surface="product"] .new-test-card-actions .button {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 11px;
}

body[data-admin-surface="product"] .new-test-empty {
  min-height: 240px;
}

body[data-admin-surface="product"] .new-test-entry-modal {
  display: flex;
  flex-direction: column;
  width: min(96vw, 1280px);
  height: min(94vh, 920px);
  max-width: none;
  max-height: none;
  overflow: hidden;
  border-radius: 22px;
}

body[data-admin-surface="product"] .new-test-entry-modal-header {
  flex: 0 0 auto;
}

body[data-admin-surface="product"] .new-test-entry-modal-header p {
  max-width: 720px;
}

body[data-admin-surface="product"] .new-test-entry-modal .new-test-entry-modal-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--ui-bg, #f5f5f7);
}

body[data-admin-surface="product"] .new-test-entry-frame {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

body[data-admin-surface="product"] .new-test-entry-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 620px;
  background: var(--ui-bg, #f5f5f7);
  border: 0;
}

body[data-admin-surface="product"] .new-test-entry-frame[data-entry-state="idle"] iframe,
body[data-admin-surface="product"] .new-test-entry-frame[data-entry-state="loading"] iframe,
body[data-admin-surface="product"] .new-test-entry-frame[data-entry-state="error"] iframe {
  visibility: hidden;
}

body[data-admin-surface="product"] .new-test-frame-status {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  text-align: center;
  color: var(--ui-text, #1d1d1f);
  background: var(--ui-bg, #f5f5f7);
}

body[data-admin-surface="product"] .new-test-frame-status[hidden] {
  display: none;
}

body[data-admin-surface="product"] .new-test-frame-status p {
  max-width: 440px;
  margin: 0;
  color: var(--ui-muted, #6e6e73);
  font-size: 13px;
}

body[data-admin-surface="product"] .new-test-frame-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 113, 227, .14);
  border-top-color: var(--ui-blue, #0071e3);
  border-radius: 50%;
  animation: new-test-spin .8s linear infinite;
}

body[data-admin-surface="product"] [data-entry-state="error"] .new-test-frame-spinner {
  animation: none;
  border-color: rgba(217, 45, 32, .28);
}

body[data-admin-surface="product"] .new-test-link-modal {
  width: min(92vw, 620px);
}

body[data-admin-surface="product"] .new-test-link-field input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

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

@media (max-width: 1180px) {
  body[data-admin-surface="product"] .new-test-hero {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  body[data-admin-surface="product"] .new-test-card {
    grid-template-columns: minmax(235px, .75fr) minmax(430px, 1.4fr);
    grid-template-areas: "head details" "note foot";
  }

  body[data-admin-surface="product"] .new-test-review-note {
    width: auto;
  }
}

@media (max-width: 880px) {
  body[data-admin-surface="product"] .new-test-entry-page-guide {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  body[data-admin-surface="product"] .new-test-entry-guide-points {
    justify-content: flex-start;
  }

  body[data-admin-surface="product"] .new-test-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-admin-surface="product"] .new-test-toolbar {
    grid-template-columns: 1fr 180px;
  }

  body[data-admin-surface="product"] .new-test-toolbar .pill {
    display: none;
  }

  body[data-admin-surface="product"] .new-test-card {
    grid-template-columns: 1fr;
    grid-template-areas: "head" "details" "note" "foot";
  }
}

@media (max-width: 680px) {
  body[data-admin-surface="product"] .new-test-entry-page-guide {
    padding: 14px;
  }

  body[data-admin-surface="product"] .new-test-entry-guide-points {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  body[data-admin-surface="product"] .new-test-entry-guide-points span {
    justify-content: flex-start;
  }

  body[data-admin-surface="product"] .new-test-entry-page .new-test-entry-frame {
    height: max(620px, calc(100dvh - 178px));
    min-height: 620px;
    border-radius: 14px;
  }

  body[data-admin-surface="product"] .topbar-actions .new-test-mobile-action {
    display: inline-flex;
  }

  body[data-admin-surface="product"] .new-test-hero {
    padding: 17px;
  }

  body[data-admin-surface="product"] .new-test-flow {
    grid-template-columns: 1fr;
  }

  body[data-admin-surface="product"] .new-test-inbox > .panel-heading,
  body[data-admin-surface="product"] .new-test-list,
  body[data-admin-surface="product"] .new-test-toolbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  body[data-admin-surface="product"] .new-test-toolbar {
    grid-template-columns: 1fr;
  }

  body[data-admin-surface="product"] .new-test-card-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-admin-surface="product"] .new-test-card-details > div:nth-child(3) {
    border-top: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
    border-left: 0;
  }

  body[data-admin-surface="product"] .new-test-card-details > div:nth-child(4) {
    border-top: 1px solid var(--ui-line, rgba(16, 24, 40, .1));
  }

  body[data-admin-surface="product"] .new-test-card-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  body[data-admin-surface="product"] .new-test-card-actions {
    justify-content: flex-start;
  }

  body[data-admin-surface="product"] .modal.new-test-entry-modal {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* 新品测试：与 Cake 厨房工作台一致的暖白、焦糖与深可可层级 */
.new-test-hero {
  align-items: center;
  background: linear-gradient(135deg, #5b4438, #3f3029);
  border-radius: 22px;
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 18px;
  overflow: hidden;
  padding: 24px 26px;
  position: relative;
}

.new-test-hero::after {
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
  content: "";
  height: 170px;
  position: absolute;
  right: 20%;
  top: 35%;
  width: 170px;
}

.new-test-hero h2 { font-size: 24px; margin: 6px 0 8px; }
.new-test-hero p { color: rgba(255, 255, 255, .72); font-size: 13px; margin: 0; }
.new-test-hero .section-kicker { color: #f7d372; }
.new-test-flow { align-items: center; display: flex; flex: 0 0 auto; gap: 7px; position: relative; z-index: 1; }
.new-test-flow span { align-items: center; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px; display: flex; flex-direction: column; font-size: 10px; gap: 4px; min-width: 78px; padding: 10px 8px; }
.new-test-flow b { color: #f7cf60; font-size: 12px; }
.new-test-flow i { color: rgba(255, 255, 255, .4); font-style: normal; }
.new-test-metrics { margin-bottom: 18px; }
.new-test-metrics button { text-align: left; width: 100%; }
.new-test-workspace { align-items: start; display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 440px; }
.new-test-inbox, .new-test-phone-panel { min-width: 0; }
.new-test-inbox-heading p, .new-test-phone-panel .panel-heading p { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.new-test-toolbar { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) 132px; margin-bottom: 14px; }
.new-test-list { display: grid; gap: 10px; }
.new-test-card { background: #fbfaf8; border: 1px solid var(--line); border-radius: 15px; padding: 14px; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.new-test-card:hover { border-color: #d8c5ad; box-shadow: 0 10px 24px rgba(84, 60, 44, .08); transform: translateY(-1px); }
.new-test-card[aria-busy="true"] { opacity: .7; pointer-events: none; }
.new-test-card-head { align-items: flex-start; display: flex; gap: 11px; }
.new-test-avatar { align-items: center; background: #fff1c8; border-radius: 11px; color: #9b6a00; display: flex; flex: 0 0 42px; font-size: 16px; font-weight: 900; height: 42px; justify-content: center; overflow: hidden; position: relative; }
.new-test-avatar img { height: 100%; object-fit: cover; width: 100%; }
.new-test-card-copy { min-width: 0; }
.new-test-card-copy h4 { font-size: 14px; margin: 1px 0 5px; }
.new-test-card-copy p { color: var(--muted); font-size: 10px; margin: 0; }
.new-test-card-head .status-badge { margin-left: auto; white-space: nowrap; }
.new-test-card-info { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.new-test-card-info span { background: #fff; border: 1px solid var(--line); border-radius: 99px; color: #756d66; font-size: 9px; padding: 5px 8px; }
.new-test-review-note { background: #fff7e3; border-left: 3px solid #dfae38; border-radius: 8px; color: #72551e; font-size: 10px; line-height: 1.55; margin: 10px 0 0; padding: 8px 10px; }
.new-test-card-foot { align-items: center; border-top: 1px dashed var(--line); display: flex; gap: 7px; justify-content: space-between; margin-top: 12px; padding-top: 11px; }
.new-test-card-foot small { color: var(--muted); font-size: 9px; }
.new-test-card-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.new-test-card-actions button { background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 10px; font-weight: 800; min-height: 31px; padding: 0 9px; }
.new-test-card-actions .primary { background: #fff2c9; border-color: #e8be52; color: #835b00; }
.new-test-card-actions .danger { color: #a13e34; }
.status-badge.draft { background: #f2f0ed; color: #777069; }
.status-badge.submitted { background: #fff2c9; color: #8f6500; }
.status-badge.rejected { background: #fff0ed; color: #9b463d; }
.status-badge.converted { background: #e8f5eb; color: #39704c; }
.new-test-empty { min-height: 220px; }
.new-test-phone-panel { position: sticky; top: calc(var(--product-sticky-top, 0px) + 14px); }
.new-test-phone-frame { background: #eee9e1; border: 1px solid var(--line); border-radius: 22px; height: min(760px, calc(100vh - var(--product-sticky-top, 0px) - 160px)); min-height: 560px; overflow: hidden; position: relative; }
.new-test-phone-frame iframe { background: #eee9e1; border: 0; display: block; height: 100%; width: 100%; }
.new-test-frame-status { align-items: center; background: #f5f0e9; display: flex; flex-direction: column; gap: 7px; inset: 0; justify-content: center; padding: 28px; position: absolute; text-align: center; z-index: 2; }
.new-test-frame-status[hidden], .new-test-frame-status [hidden] { display: none !important; }
.new-test-frame-status strong { color: #4b3a31; font-size: 14px; }
.new-test-frame-status small { color: #8f847b; font-size: 10px; line-height: 1.6; max-width: 250px; }
.new-test-frame-status .button { margin-top: 8px; }
.new-test-frame-spinner { animation: newTestFrameSpin .8s linear infinite; border: 3px solid rgba(118, 84, 55, .15); border-radius: 50%; border-top-color: #bc8720; height: 28px; width: 28px; }
.new-test-phone-frame[data-entry-state="error"] .new-test-frame-spinner { animation: none; border-color: #dba9a2; position: relative; }
.new-test-phone-frame[data-entry-state="error"] .new-test-frame-spinner::after { color: #a84f44; content: "!"; font-size: 15px; font-weight: 900; inset: 1px 0 0; position: absolute; }
@keyframes newTestFrameSpin { to { transform: rotate(360deg); } }

@media (max-width: 1200px) {
  .new-test-workspace { grid-template-columns: minmax(0, 1fr) 400px; }
}

@media (max-width: 980px) {
  .new-test-hero { align-items: flex-start; flex-direction: column; }
  .new-test-workspace { grid-template-columns: 1fr; }
  .new-test-phone-panel { position: static; }
  .new-test-phone-frame { height: 760px; margin: 0 auto; max-width: 430px; }
}

@media (max-width: 640px) {
  .new-test-hero { padding: 20px; }
  .new-test-flow { gap: 4px; width: 100%; }
  .new-test-flow span { flex: 1; min-width: 0; }
  .new-test-toolbar { grid-template-columns: 1fr; }
  .new-test-card-foot { align-items: flex-start; flex-direction: column; }
  .new-test-card-actions { justify-content: flex-start; }
  .new-test-phone-frame { border-radius: 15px; height: calc(100dvh - 170px); min-height: 600px; }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

button,
select {
  cursor: pointer;
}

svg {
  display: block;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: 260px;
  height: 100vh;
  flex-direction: column;
  padding: 22px 16px 18px;
  overflow-y: auto;
  color: #dbe3f0;
  background:
    radial-gradient(circle at 20% 5%, rgba(99, 102, 241, 0.18), transparent 24%),
    linear-gradient(180deg, #111827 0%, #0f172a 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #6366f1, #4338ca);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.28);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy span {
  display: block;
}

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

.brand-copy span {
  margin-top: 2px;
  color: #8f9bb0;
  font-size: 11px;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-label {
  margin: 14px 10px 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-item,
.sidebar-tool {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #9eabc0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  transition: 160ms ease;
}

.nav-item svg,
.sidebar-tool svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
}

.nav-item:hover,
.sidebar-tool:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.30), rgba(99, 102, 241, 0.12));
  border-color: rgba(129, 140, 248, 0.22);
  box-shadow: inset 3px 0 0 #818cf8;
}

.nav-count {
  min-width: 24px;
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #b9c3d5;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.nav-item.active .nav-count {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-spacer {
  min-height: 30px;
  flex: 1;
}

.sidebar-tool {
  margin-top: 12px;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.sidebar-footer {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 8px;
  margin-top: 14px;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #8793a8;
  font-size: 11px;
}

.sidebar-footer small {
  grid-column: 2;
  color: #5e6a7f;
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.save-dot.saving {
  background: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
}

.workspace {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 34px;
  border-bottom: 1px solid rgba(213, 220, 231, 0.85);
  background: rgba(243, 245, 249, 0.9);
  backdrop-filter: blur(18px);
}

.topbar-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.topbar h1 {
  margin: 1px 0 0;
  font-size: clamp(23px, 2vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.page-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions,
.toolbar-actions,
.hero-actions,
.formula-actions,
.modal-footer > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions > [hidden] {
  display: none !important;
}

.mobile-menu {
  display: none;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: #fff;
  font-size: 23px;
  line-height: 1;
  transition: 150ms ease;
}

.icon-button:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.icon-button.sidebar-close,
.icon-button.mobile-menu {
  display: none;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 120ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

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

.button:active {
  transform: translateY(0);
}

.button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.button.primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 9px 20px rgba(79, 70, 229, 0.2);
}

.button.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 11px 22px rgba(79, 70, 229, 0.26);
}

.button.secondary,
.button.ghost {
  color: #344054;
  border-color: var(--line-strong);
  background: #fff;
}

.button.secondary:hover,
.button.ghost:hover {
  border-color: #bdc7d6;
  background: #f9fafb;
}

.button.light {
  color: #312e81;
  background: #fff;
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.16);
}

.button.text-light {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.button.danger {
  color: #fff;
  background: var(--red);
}

.button.small {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12px;
}

.button.full {
  width: 100%;
}

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

.link-button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: none;
  font-size: 12px;
  font-weight: 800;
}

.content {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 26px 34px 48px;
}

.view {
  display: none;
  animation: viewIn 180ms ease;
}

.view.active {
  display: block;
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  align-items: center;
  gap: 28px;
  min-height: 254px;
  padding: 34px 38px;
  overflow: hidden;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(129, 140, 248, 0.48), transparent 26%),
    radial-gradient(circle at 15% 100%, rgba(14, 165, 233, 0.18), transparent 35%),
    linear-gradient(125deg, #3730a3 0%, #4f46e5 48%, #6366f1 100%);
  box-shadow: 0 24px 55px rgba(67, 56, 202, 0.22);
}

.hero-panel::after {
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 50px rgba(255, 255, 255, 0.035), 0 0 0 100px rgba(255, 255, 255, 0.022);
  content: "";
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  display: inline-flex;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 800;
}

.hero-panel h2 {
  max-width: 760px;
  margin: 16px 0 10px;
  font-size: clamp(28px, 3vw, 43px);
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.hero-panel p {
  max-width: 720px;
  margin: 0 0 22px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
}

.health-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 18px;
  background: rgba(17, 24, 39, 0.2);
  backdrop-filter: blur(12px);
}

.health-ring {
  --health: 100%;
  position: relative;
  display: grid;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(#fff var(--health), rgba(255, 255, 255, 0.16) 0);
}

.health-ring::before {
  position: absolute;
  width: 69px;
  height: 69px;
  border-radius: 50%;
  background: #4b45d5;
  content: "";
}

.health-ring span {
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 900;
}

.health-card strong,
.health-card span {
  display: block;
}

.health-card strong {
  font-size: 15px;
}

.health-card > div:last-child span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  gap: 16px;
}

.overview-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.metric-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 15px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 900;
}

.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }

.metric-card div {
  min-width: 0;
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  margin: 1px 0 0;
  font-size: 27px;
  line-height: 1.2;
}

.metric-card small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.dashboard-grid.lower-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.flow-panel,
.alerts-panel,
.dashboard-grid.lower-grid > .panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading h3,
.form-section-title h3,
.quote-heading h3,
.settings-panel h3 {
  margin: 3px 0 0;
  font-size: 17px;
  line-height: 1.3;
}

.pill,
.basis-chip,
.status-badge,
.price-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  white-space: nowrap;
}

.pill {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
}

.pill.accent {
  color: var(--accent);
  background: var(--accent-soft);
}

.data-flow {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr) auto minmax(120px, 1fr) auto minmax(135px, 1.1fr);
  align-items: center;
  gap: 10px;
}

.flow-node {
  position: relative;
  min-height: 128px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel-soft);
  text-align: left;
  transition: 160ms ease;
}

.flow-node:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 12px 25px rgba(79, 70, 229, 0.08);
}

.flow-node.result {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, #4f46e5, #6366f1);
}

.flow-node span,
.flow-node strong,
.flow-node small {
  display: block;
}

.flow-index {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.flow-node.result .flow-index,
.flow-node.result small {
  color: rgba(255, 255, 255, 0.72);
}

.flow-node strong {
  margin: 15px 0 5px;
  font-size: 15px;
}

.flow-node small {
  color: var(--muted);
  font-size: 11px;
}

.flow-arrow {
  color: var(--muted-2);
  font-size: 20px;
  font-weight: 800;
}

.flow-arrow.equals {
  margin-left: -4px;
}

.compact-list,
.timeline-list {
  display: grid;
  gap: 9px;
}

.alert-item,
.timeline-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.alert-mark,
.timeline-mark {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  font-weight: 900;
}

.timeline-mark {
  color: var(--accent);
  background: var(--accent-soft);
}

.alert-item div,
.timeline-item div {
  min-width: 0;
  flex: 1;
}

.alert-item strong,
.alert-item span,
.timeline-item strong,
.timeline-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-item strong,
.timeline-item strong {
  font-size: 12px;
}

.alert-item span,
.timeline-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.pricing-mode-display {
  padding: 6px 2px 2px;
}

.pricing-mode-display > span,
.pricing-mode-display > strong {
  display: block;
}

.pricing-mode-display > span {
  color: var(--muted);
  font-size: 12px;
}

.pricing-mode-display > strong {
  margin-top: 5px;
  color: var(--accent);
  font-size: 27px;
}

.pricing-mode-display p {
  min-height: 42px;
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.section-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.section-tab {
  min-height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.section-tab span {
  display: inline-grid;
  min-width: 20px;
  margin-left: 5px;
  place-items: center;
  color: inherit;
  font-size: 11px;
}

.section-tab.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.compact-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.mini-metric {
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.mini-metric span,
.mini-metric strong {
  display: block;
}

.mini-metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.mini-metric strong {
  margin-top: 4px;
  font-size: 23px;
}

.mini-metric.warning strong {
  color: var(--red);
}

.table-panel {
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.table-toolbar.wrap {
  flex-wrap: wrap;
}

.filter-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  width: min(320px, 100%);
  min-width: 210px;
}

.search-box svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  fill: var(--muted-2);
  pointer-events: none;
}

.search-box input,
.select-control,
.form-grid input,
.form-grid select,
.form-grid textarea,
.settings-grid input,
.settings-grid select,
.formula-table input,
.formula-table select,
.quote-table input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  color: var(--text);
  background: #fff;
  transition: 140ms ease;
}

.search-box input,
.select-control {
  min-height: 40px;
}

.search-box input {
  padding: 0 13px 0 38px;
}

.select-control {
  min-width: 130px;
  padding: 0 32px 0 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #a5b4fc !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.table-container {
  min-height: 150px;
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #edf0f5;
  vertical-align: middle;
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  color: #778195;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover {
  background: #fafbff;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table .center {
  text-align: center;
}

.data-table .actions-cell {
  white-space: nowrap;
}

.primary-cell {
  min-width: 160px;
}

.primary-cell strong,
.primary-cell span,
.primary-cell small {
  display: block;
}

.primary-cell strong {
  color: var(--text);
  font-size: 13px;
}

.primary-cell span,
.primary-cell small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.price-main {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.price-sub {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
}

.price-chip {
  min-height: 25px;
  padding: 0 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
}

.price-chip.median {
  color: #7c3aed;
  background: #f5f3ff;
}

.status-badge {
  min-height: 25px;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 900;
}

.status-badge.active,
.status-badge.complete {
  color: var(--green);
  background: var(--green-soft);
}

.status-badge.archived {
  color: #64748b;
  background: #f1f5f9;
}

.status-badge.warning,
.status-badge.missing {
  color: var(--red);
  background: var(--red-soft);
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.row-button {
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #526078;
  background: #fff;
  font-size: 10px;
  font-weight: 800;
}

.row-button:hover {
  color: var(--accent);
  border-color: #c7d2fe;
  background: var(--accent-soft);
}

.row-button.danger:hover {
  color: var(--red);
  border-color: #fecdd3;
  background: var(--red-soft);
}

.library-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 2px 2px 0;
}

.library-intro h2 {
  margin: 5px 0 4px;
  font-size: 24px;
}

.library-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.legend-row span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.live { background: var(--accent); }
.legend-dot.median { background: #8b5cf6; }

.settings-panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.settings-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
}

.settings-panel summary::-webkit-details-marker {
  display: none;
}

.settings-panel summary p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.summary-chevron {
  color: var(--muted);
  font-size: 22px;
  transition: transform 160ms ease;
}

.settings-panel[open] .summary-chevron {
  transform: rotate(180deg);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.settings-grid label,
.form-grid label {
  display: block;
  min-width: 0;
}

.settings-grid label > span,
.form-grid label > span {
  display: block;
  margin-bottom: 6px;
  color: #49566c;
  font-size: 11px;
  font-weight: 800;
}

.settings-grid input,
.settings-grid select,
.form-grid input,
.form-grid select {
  min-height: 40px;
  padding: 0 11px;
}

.settings-grid small {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9px;
}

.input-prefix,
.input-suffix {
  position: relative;
}

.input-prefix b,
.input-suffix b {
  position: absolute;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.input-prefix b { left: 11px; }
.input-suffix b { right: 11px; }
.input-prefix input { padding-left: 27px !important; }
.input-suffix input { padding-right: 32px !important; }

.basis-chip {
  min-height: 32px;
  padding: 0 11px;
  color: var(--muted);
  background: #f1f5f9;
  font-size: 10px;
}

.basis-chip strong {
  margin-left: 3px;
  color: var(--accent);
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  align-content: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state.small {
  min-height: 180px;
}

.empty-state .empty-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 20px;
  font-weight: 900;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  color: #475569;
  font-size: 13px;
}

.empty-state span {
  max-width: 340px;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  display: flex;
  width: min(96vw, 760px);
  max-height: min(92vh, 980px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: modalIn 170ms ease;
}

.modal-md { width: min(96vw, 680px); }
.modal-lg { width: min(96vw, 940px); }
.modal-xl { width: min(96vw, 1240px); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  background: #fff;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 3px 0 0;
  font-size: 21px;
}

.modal-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.modal-body {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
  background: #fbfcfe;
}

.bulk-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(25, 72, 139, 0.06);
}

.modal-footer {
  border-top: 1px solid var(--line);
}

.modal-hint {
  color: var(--muted);
  font-size: 10px;
}

.pricing-link-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 18px 42px rgba(25, 72, 139, 0.08);
}

.pricing-link-status {
  display: grid;
  gap: 5px;
  color: #5f6878;
  font-size: 13px;
  line-height: 1.7;
}

.pricing-link-status strong {
  color: #111827;
  font-size: 18px;
}

.pricing-link-field {
  display: grid;
  gap: 8px;
  color: #5f6878;
  font-size: 12px;
  font-weight: 800;
}

.pricing-link-field textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid #dbe4ef;
  border-radius: 14px;
  background: #fff;
  color: #111827;
  font: 700 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 13px 14px;
  outline: none;
}

.pricing-link-field textarea:focus {
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.form-section {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.form-section-title > span {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 900;
}

.form-section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.formula-title-row .formula-actions {
  margin-left: auto;
}

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

.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; }

.dessert-price-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid #dbe7f7;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7fbff 0%, #fffafd 100%);
}

.dessert-price-title-row .button {
  margin-left: auto;
}

.form-grid textarea {
  min-height: 68px;
  padding: 10px 11px;
  resize: vertical;
}

.formula-table-wrap,
.quote-editor {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.formula-table,
.quote-table {
  width: 100%;
  min-width: 870px;
  border-collapse: collapse;
  background: #fff;
  font-size: 11px;
}

.formula-table th,
.formula-table td,
.quote-table th,
.quote-table td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

.formula-table th,
.quote-table th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.formula-table tr:last-child td,
.quote-table tr:last-child td {
  border-bottom: 0;
}

.formula-table input,
.formula-table select,
.quote-table input {
  min-height: 34px;
  padding: 0 8px;
  border-radius: 8px;
}

.formula-table .line-cost {
  min-width: 76px;
  color: var(--text);
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.formula-empty,
.quote-empty {
  padding: 30px 20px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  font-size: 11px;
}

.formula-preview {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #f7f8ff;
  font-size: 11px;
}

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

.formula-preview strong {
  margin-left: 4px;
  color: var(--text);
}

.formula-preview .preview-total strong {
  color: var(--accent);
  font-size: 15px;
}

.quote-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.quote-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.quote-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.quote-stat {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.quote-stat span,
.quote-stat strong {
  display: block;
}

.quote-stat span {
  color: var(--muted);
  font-size: 9px;
}

.quote-stat strong {
  margin-top: 3px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.quote-stat.live {
  border-color: #c7d2fe;
  background: var(--accent-soft);
}

.cost-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 18px;
}

.cost-card-metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.cost-card-metric span,
.cost-card-metric strong,
.cost-card-metric small {
  display: block;
}

.cost-card-metric span {
  color: var(--muted);
  font-size: 9px;
}

.cost-card-metric strong {
  margin-top: 4px;
  font-size: 18px;
}

.cost-card-metric small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
}

.cost-card-metric.accent {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(145deg, #4f46e5, #6366f1);
}

.cost-card-metric.accent span,
.cost-card-metric.accent small {
  color: rgba(255, 255, 255, 0.72);
}

.cost-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
  gap: 16px;
}

.cost-detail-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.cost-detail-panel h3 {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.cost-breakdown {
  padding: 14px 16px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: 1fr minmax(80px, auto);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 11px;
}

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

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

.breakdown-row strong {
  text-align: right;
}

.breakdown-row.total {
  margin-top: 5px;
  padding-top: 13px;
  font-size: 13px;
}

.breakdown-row.total strong {
  color: var(--accent);
}

.data-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.data-summary-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.data-summary-item span,
.data-summary-item strong {
  display: block;
}

.data-summary-item span {
  color: var(--muted);
  font-size: 9px;
}

.data-summary-item strong {
  margin-top: 3px;
  font-size: 20px;
}

.data-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.data-action-card {
  display: grid;
  min-height: 128px;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 3px 12px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  transition: 150ms ease;
}

.data-action-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.08);
}

.data-action-icon {
  display: grid;
  width: 42px;
  height: 42px;
  grid-row: 1 / span 2;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 16px;
  font-weight: 900;
}

.data-action-card strong {
  align-self: end;
  font-size: 12px;
}

.data-action-card small {
  align-self: start;
  color: var(--muted);
  font-size: 9px;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #fecdd3;
  border-radius: 13px;
  background: var(--red-soft);
}

.danger-zone strong,
.danger-zone span {
  display: block;
}

.danger-zone strong {
  color: #9f1239;
  font-size: 12px;
}

.danger-zone span {
  margin-top: 2px;
  color: #be123c;
  font-size: 9px;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 200;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  color: #fff;
  background: #172033;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
  animation: toastIn 180ms ease;
  pointer-events: none;
}

.toast.success { background: #0f766e; }
.toast.error { background: #b91c1c; }
.toast.warning { background: #b45309; }

.toast-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 900;
}

.toast strong,
.toast span {
  display: block;
}

.toast strong { font-size: 12px; }
.toast span { margin-top: 2px; color: rgba(255, 255, 255, 0.75); font-size: 10px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-mask {
  display: none;
}

@media (max-width: 1280px) {
  .overview-metrics,
  .compact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-flow {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .flow-arrow {
    display: none;
  }

  .flow-node.result {
    grid-column: auto;
  }

  .settings-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cost-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-column: 1;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-button.sidebar-close,
  .icon-button.mobile-menu {
    display: inline-grid;
  }

  .sidebar-mask {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
  }

  .sidebar-mask.open {
    display: block;
  }

  .dashboard-grid,
  .dashboard-grid.lower-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .health-card {
    width: min(420px, 100%);
  }

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

@media (max-width: 760px) {
  .topbar {
    min-height: 88px;
    padding: 14px 16px;
  }

  .page-description,
  #topExportBtn {
    display: none;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .content {
    padding: 18px 14px 38px;
  }

  .hero-panel {
    min-height: 0;
    padding: 26px 22px;
  }

  .hero-panel h2 {
    font-size: 29px;
  }

  .hero-actions,
  .toolbar-actions {
    flex-wrap: wrap;
  }

  .overview-metrics,
  .compact-metrics,
  .settings-grid,
  .cost-card-grid,
  .quote-stats,
  .data-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-flow {
    grid-template-columns: 1fr;
  }

  .flow-node.result {
    grid-column: auto;
  }

  .table-toolbar,
  .library-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box,
  .filter-row,
  .select-control {
    width: 100%;
    min-width: 0;
  }

  .filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .filter-row .search-box {
    grid-column: 1 / -1;
  }

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

  .form-grid.cols-3,
  .form-grid.cols-4 {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: span 2;
  }

  .dessert-price-panel {
    grid-template-columns: 1fr;
  }

  .dessert-price-title-row {
    flex-wrap: wrap;
  }

  .dessert-price-title-row .button {
    width: 100%;
    margin-left: 43px;
  }

  .formula-title-row {
    flex-wrap: wrap;
  }

  .formula-title-row .formula-actions {
    width: 100%;
    margin-left: 43px;
  }

  .cost-detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: 96vh;
    border-radius: 20px 20px 0 0;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-footer > div,
  .modal-footer .button {
    width: 100%;
  }

  .data-action-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar-actions .button.primary {
    min-width: 44px;
    padding: 0 11px;
    font-size: 0;
  }

  .topbar-actions .button.primary::before {
    content: "+";
    font-size: 22px;
    font-weight: 500;
  }

  .overview-metrics,
  .compact-metrics,
  .settings-grid,
  .cost-card-grid,
  .quote-stats,
  .data-summary,
  .form-grid.cols-3,
  .form-grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: span 1;
  }

  .health-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .filter-row .search-box {
    grid-column: auto;
  }

  .section-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .section-tab {
    padding: 0 8px;
  }

  .danger-zone {
    align-items: stretch;
    flex-direction: column;
  }
}

/* v3.1: 尺寸识别、自动配送与可搜索配方下拉 */
.auto-field[readonly] {
  color: #475569;
  background: #f8fafc;
  cursor: default;
}

.auto-field[readonly]:focus {
  border-color: var(--line-strong) !important;
  box-shadow: none;
}

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
}

.size-cell {
  min-width: 82px;
  white-space: nowrap;
}

.size-chip {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 10px;
  font-weight: 900;
}

.product-table {
  min-width: 1380px;
}

.cost-table {
  min-width: 1540px;
}

.formula-table {
  min-width: 1080px;
}

.formula-item-cell {
  min-width: 250px;
}

.formula-item-picker {
  display: grid;
  min-width: 230px;
  gap: 6px;
}

.formula-item-picker input[type="search"] {
  background: #f8fafc;
}

.formula-item-picker select {
  min-width: 230px;
}

@media (max-width: 760px) {
  .formula-item-cell,
  .formula-item-picker,
  .formula-item-picker select {
    min-width: 210px;
  }
}

/* v4.0 — 产品档案、公式成本与操作日志视觉重构 */
:root {
  --bg: #f6f2f1;
  --panel: #fffdfc;
  --panel-soft: #fbf7f6;
  --sidebar: #241b24;
  --sidebar-soft: #332633;
  --text: #2f2630;
  --muted: #766b75;
  --muted-2: #9c909a;
  --line: #eadfe3;
  --line-strong: #d9cbd1;
  --accent: #9b4668;
  --accent-strong: #7e3454;
  --accent-soft: #fff0f5;
  --green: #2d8b6f;
  --green-soft: #eaf7f2;
  --amber: #b9741e;
  --amber-soft: #fff6e8;
  --red: #bd3d52;
  --red-soft: #fff0f2;
  --blue: #5767a8;
  --blue-soft: #eff1fb;
  --shadow-sm: 0 1px 2px rgba(58, 35, 47, 0.04);
  --shadow-md: 0 18px 50px rgba(61, 38, 51, 0.08);
  --shadow-lg: 0 32px 100px rgba(47, 28, 40, 0.22);
  --radius: 22px;
  --radius-sm: 14px;
}

body {
  background:
    radial-gradient(circle at 82% -8%, rgba(185, 112, 143, 0.10), transparent 29rem),
    linear-gradient(180deg, #faf7f6 0, var(--bg) 420px);
}

.app-shell {
  grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
  width: 272px;
  padding: 24px 17px 18px;
  color: #eee5eb;
  background:
    radial-gradient(circle at 22% 2%, rgba(204, 112, 151, 0.20), transparent 17rem),
    radial-gradient(circle at 110% 72%, rgba(132, 87, 119, 0.18), transparent 22rem),
    linear-gradient(180deg, #2a202b 0%, #211820 100%);
  border-right-color: rgba(255, 255, 255, 0.07);
  box-shadow: 18px 0 45px rgba(42, 27, 37, 0.07);
}

.workspace {
  grid-column: 2;
}

.brand-mark {
  border-color: rgba(255, 255, 255, 0.20);
  border-radius: 16px;
  background: linear-gradient(145deg, #bc6a8c, #863b5d);
  box-shadow: 0 14px 30px rgba(143, 60, 94, 0.35);
}

.brand-copy span,
.sidebar-footer,
.sidebar-footer small {
  color: #aa9ca7;
}

.nav-label {
  color: #8f808c;
}

.nav-item,
.sidebar-tool {
  min-height: 50px;
  border-radius: 14px;
  color: #bfb2bc;
}

.nav-item:hover,
.sidebar-tool:hover {
  background: rgba(255, 255, 255, 0.065);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(190, 102, 142, 0.27), rgba(190, 102, 142, 0.07));
  border-color: rgba(225, 151, 183, 0.22);
  box-shadow: inset 3px 0 0 #d28daf, 0 10px 24px rgba(18, 8, 14, 0.12);
}

.topbar {
  min-height: 86px;
  padding-inline: 34px;
  background: rgba(255, 253, 252, 0.82);
  border-bottom-color: rgba(220, 205, 212, 0.78);
  backdrop-filter: blur(18px) saturate(145%);
}

.main-content {
  padding: 28px 34px 54px;
}

.panel,
.mini-metric,
.hero-panel,
.settings-panel {
  border-color: rgba(221, 207, 213, 0.88);
  background: rgba(255, 253, 252, 0.94);
  box-shadow: 0 18px 48px rgba(64, 39, 52, 0.055);
}

.panel:hover,
.mini-metric:hover {
  border-color: #d8c4cc;
}

.hero-panel {
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 18%, rgba(180, 90, 130, 0.13), transparent 20rem),
    linear-gradient(135deg, #fffdfc 0%, #fff7fa 100%);
}

.hero-panel::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  right: -78px;
  bottom: -108px;
  border: 34px solid rgba(161, 69, 107, 0.045);
  border-radius: 50%;
  pointer-events: none;
}

.section-kicker {
  color: var(--accent);
  letter-spacing: 0.18em;
}

.button.primary {
  border-color: var(--accent-strong);
  background: linear-gradient(135deg, #a95075, #7c3453);
  box-shadow: 0 10px 24px rgba(143, 62, 95, 0.22);
}

.button.primary:hover {
  background: linear-gradient(135deg, #b3587d, #843858);
  box-shadow: 0 14px 30px rgba(143, 62, 95, 0.28);
}

.button.secondary,
.row-button,
.select-control,
.search-box,
input,
select,
textarea {
  border-color: var(--line);
}

.button.secondary:hover,
.row-button:hover {
  border-color: #cfb8c2;
  color: var(--accent-strong);
  background: #fff7fa;
}

input:focus,
select:focus,
textarea:focus,
.search-box:focus-within {
  border-color: rgba(155, 70, 104, 0.58) !important;
  box-shadow: 0 0 0 4px rgba(155, 70, 104, 0.10) !important;
}

.data-table thead th {
  color: #776a74;
  background: #fbf6f7;
  border-bottom-color: #e4d7dc;
}

.data-table tbody tr:hover {
  background: #fff9fb;
}

.price-main,
.price-chip {
  color: var(--accent-strong);
}

.size-chip {
  border-color: #e8cfd9;
  color: #87425f;
  background: #fff1f6;
}

.table-sort-note {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: #806f79;
  background: linear-gradient(90deg, #fff8fa, #fffdfc);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.product-table {
  min-width: 1760px;
}

.row-index {
  color: #a2939c;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.log-cell {
  min-width: 215px;
}

.latest-log {
  display: grid;
  min-width: 190px;
  gap: 2px;
}

.latest-log strong {
  color: #4b3944;
  font-size: 11px;
}

.latest-log span {
  max-width: 240px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latest-log.muted span {
  color: var(--muted-2);
}

.inline-log-button {
  width: max-content;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.inline-log-button:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.updated-cell {
  min-width: 138px;
}

.updated-cell time {
  display: inline-block;
  color: #6f626b;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
  white-space: normal;
}

/* 产品编辑器 */
.modal-editor {
  width: min(98vw, 1480px);
  max-height: min(94vh, 1040px);
  border-color: rgba(216, 198, 207, 0.92);
  background: #fffdfc;
}

.product-editor-header {
  padding: 20px 26px;
  background: linear-gradient(90deg, #fffdfc, #fff7fa);
}

.product-modal-body {
  padding: 0;
  background: #f8f3f4;
}

.product-editor-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 650px;
}

.product-editor-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: fit-content;
  min-height: 650px;
  flex-direction: column;
  padding: 24px 18px;
  color: #f8edf3;
  background:
    radial-gradient(circle at 110% 2%, rgba(255, 188, 217, 0.18), transparent 15rem),
    linear-gradient(180deg, #4a2c3b 0%, #30212c 100%);
}

.editor-product-preview {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 18px 40px rgba(18, 8, 13, 0.15);
}

.editor-overline {
  color: #dcb5c7;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.editor-product-preview > strong {
  display: block;
  margin-top: 10px;
  overflow: hidden;
  color: #fff;
  font-size: 20px;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-product-preview > p {
  margin: 5px 0 16px;
  color: #cbbbc4;
  font-size: 11px;
}

.editor-preview-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.editor-preview-stats div {
  padding: 11px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.075);
}

.editor-preview-stats span,
.editor-preview-stats b {
  display: block;
}

.editor-preview-stats span {
  color: #c1adb8;
  font-size: 9px;
}

.editor-preview-stats b {
  margin-top: 4px;
  color: #fff;
  font-size: 13px;
}

.editor-step-nav {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.editor-step-nav button {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 9px;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #d8c9d1;
  background: transparent;
  text-align: left;
}

.editor-step-nav button:hover,
.editor-step-nav button:focus-visible {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
}

.editor-step-nav button > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  color: #f6dce8;
  background: rgba(220, 139, 176, 0.16);
  font-size: 10px;
  font-weight: 900;
}

.editor-step-nav strong,
.editor-step-nav small {
  display: block;
}

.editor-step-nav strong {
  color: #fff;
  font-size: 11px;
}

.editor-step-nav small {
  margin-top: 2px;
  color: #a998a2;
  font-size: 9px;
}

.editor-import-note {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.045);
}

.editor-import-note span {
  color: #f1d2e0;
  font-size: 10px;
  font-weight: 850;
}

.editor-import-note p {
  margin: 6px 0 0;
  color: #b8a7b1;
  font-size: 9px;
  line-height: 1.65;
}

.product-editor-main {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 24px;
}

.product-editor-main .form-section {
  margin: 0;
  padding: 22px;
  border: 1px solid #e7dadd;
  border-radius: 20px;
  background: #fffdfc;
  box-shadow: 0 12px 32px rgba(63, 36, 51, 0.045);
  scroll-margin-top: 20px;
}

.form-section-title {
  align-items: flex-start;
}

.form-section-title > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 900;
}

.form-section-title h3 {
  font-size: 15px;
}

.form-section-title p {
  color: var(--muted);
}

.formula-workbench {
  overflow: hidden;
}

.formula-title-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
}

.formula-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.formula-table-wrap {
  margin-top: 16px;
  overflow: auto;
  border: 1px solid #e8dce1;
  border-radius: 16px;
  background: #fff;
}

.formula-table {
  width: 100%;
  min-width: 0;
  font-size: 13px;
  table-layout: fixed;
}

.formula-col-item { width: 27%; }
.formula-col-section { width: 8%; }
.formula-col-qty { width: 7%; }
.formula-col-unit { width: 7%; }
.formula-col-loss { width: 8%; }
.formula-col-fixed { width: 15%; }
.formula-col-price { width: 10%; }
.formula-col-cost { width: 10%; }
.formula-col-action { width: 7%; }

.formula-table-wrap {
  overflow-x: hidden;
}

.formula-table th {
  padding-block: 11px;
  color: #7e6d77;
  background: #fbf6f8;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.formula-table tr.integrity-review-row > td {
  background: rgba(255, 247, 224, 0.72);
}

.formula-table tr.formula-quantity-invalid > td {
  border-top-color: rgba(190, 72, 72, 0.28);
  border-bottom-color: rgba(190, 72, 72, 0.28);
}

.formula-quantity-cell input[aria-invalid="true"] {
  border-color: #c95d5d;
  background: #fff8f7;
}

.formula-integrity-warning {
  display: block;
  min-width: 150px;
  margin-top: 6px;
  color: #9a4d13;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
}

.formula-table td {
  min-width: 0;
  padding: 11px 10px;
  vertical-align: top;
}

.formula-table input,
.formula-table select {
  min-width: 0;
  min-height: 42px;
  border-radius: 10px;
  background: #fffdfc;
  font-size: 13px;
}

.formula-section-row td {
  padding: 9px 14px !important;
  border-top: 1px solid #e4d3da;
  border-bottom: 1px solid #ebdfe4 !important;
  background: linear-gradient(90deg, #fff1f6, #fff9fb);
}

.formula-section-row td,
.cost-section-row td {
  color: #7c3d59;
}

.formula-section-row td span,
.formula-section-row td b,
.formula-section-row td strong {
  margin-right: 12px;
}

.formula-section-row td span {
  font-size: 11px;
  font-weight: 900;
}

.formula-section-row td b {
  color: #a17a8c;
  font-size: 9px;
}

.formula-section-row td strong {
  float: right;
  color: var(--accent-strong);
  font-size: 11px;
}

.formula-item-picker {
  min-width: 0;
  gap: 5px;
}

.formula-item-picker input[type="search"] {
  background: #fbf7f8;
}

.formula-source {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #9b7587;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid #e7c5d4;
  border-radius: 999px;
  color: #8a3f60;
  background: #fff0f5;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.formula-fixed-input {
  min-width: 0;
}

.formula-empty {
  display: grid;
  min-height: 160px;
  place-content: center;
  gap: 5px;
  padding: 30px;
  text-align: center;
}

.formula-empty strong {
  color: #4d3c46;
  font-size: 14px;
}

.formula-empty span {
  max-width: 520px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.editor-focus-flash {
  animation: editorFocusFlash 1.25s ease;
}

@keyframes editorFocusFlash {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: inset 0 0 0 2px rgba(155, 70, 104, 0.46), 0 0 0 5px rgba(155, 70, 104, 0.10); }
}

/* 成本卡 */
.cost-card-hero {
  display: flex;
  min-height: 142px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px;
  overflow: hidden;
  border-radius: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 86% 4%, rgba(255, 255, 255, 0.17), transparent 15rem),
    linear-gradient(135deg, #4f2d3e, #8d4162 72%, #ac5d7e);
  box-shadow: 0 24px 54px rgba(83, 39, 60, 0.20);
}

.cost-card-overline {
  color: #f4cfe0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.cost-card-hero h3 {
  margin: 8px 0 4px;
  color: #fff;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.12;
}

.cost-card-hero p {
  margin: 0;
  color: #e9d8e1;
  font-size: 11px;
}

.cost-card-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cost-card-hero-actions > span {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 9px;
  font-weight: 850;
}

.button.light {
  border-color: rgba(255, 255, 255, 0.28);
  color: #4d2d3c;
  background: #fff;
}

.cost-card-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.cost-card-metric {
  min-height: 108px;
  padding: 17px;
  border: 1px solid #e9dde2;
  border-radius: 17px;
  background: #fffdfc;
  box-shadow: 0 12px 30px rgba(63, 38, 51, 0.045);
}

.cost-card-metric strong {
  color: #483943;
  font-size: 20px;
}

.cost-card-metric.accent {
  border-color: transparent;
  background: linear-gradient(145deg, #fff0f5, #f9dce8);
}

.cost-card-metric.accent strong {
  color: var(--accent-strong);
}

.section-cost-strip {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid #e7dade;
  border-radius: 18px;
  background: #fffafc;
}

.section-cost-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 11px;
}

.section-cost-heading span {
  color: #4d3b45;
  font-size: 12px;
  font-weight: 850;
}

.section-cost-heading small {
  color: var(--muted-2);
  font-size: 9px;
}

.section-cost-strip > div:last-child {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.section-cost-card {
  padding: 11px 12px;
  border: 1px solid #ecdee4;
  border-radius: 13px;
  background: #fff;
}

.section-cost-card span,
.section-cost-card strong,
.section-cost-card small {
  display: block;
}

.section-cost-card span {
  color: #8f7280;
  font-size: 9px;
  font-weight: 800;
}

.section-cost-card strong {
  margin-top: 3px;
  color: #4e3c46;
  font-size: 13px;
}

.section-cost-card small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 8px;
}

.cost-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(270px, 0.75fr);
  align-items: start;
  gap: 14px;
  margin-top: 14px;
}

.cost-detail-side {
  display: grid;
  gap: 14px;
}

.cost-detail-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e7dade;
  border-radius: 18px;
  background: #fffdfc;
}

.cost-panel-heading {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #eadfe3;
  background: #fcf8f9;
}

.cost-panel-heading span {
  color: var(--accent);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.cost-panel-heading h3 {
  margin: 2px 0 0;
  font-size: 13px;
}

.cost-detail-table {
  min-width: 920px;
}

.cost-section-row td {
  padding: 9px 14px !important;
  background: #fff2f7;
}

.cost-section-row span,
.cost-section-row b,
.cost-section-row strong {
  margin-right: 10px;
}

.cost-section-row strong {
  float: right;
}

.cost-breakdown {
  padding: 8px 16px 14px;
}

.breakdown-row {
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dashed #eadde2;
  font-size: 10px;
}

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

.breakdown-row span small {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.35;
}

.breakdown-row strong {
  color: #493943;
}

.breakdown-row.total {
  margin: 8px -5px 0;
  padding: 0 7px;
  border-bottom: 0;
  border-radius: 10px;
  background: #fff0f5;
}

.breakdown-row.total strong {
  color: var(--accent-strong);
  font-size: 14px;
}

.cost-log-body {
  padding: 16px;
}

.cost-log-body strong,
.cost-log-body p,
.cost-log-body time {
  display: block;
}

.cost-log-body strong {
  font-size: 11px;
}

.cost-log-body p {
  margin: 5px 0 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.cost-log-body time {
  color: var(--muted-2);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

/* 操作日志 */
.activity-log-modal {
  width: min(96vw, 920px);
}

.activity-log-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.activity-log-summary > div {
  padding: 14px 16px;
  border: 1px solid #e8dce1;
  border-radius: 15px;
  background: #fff9fb;
}

.activity-log-summary span,
.activity-log-summary strong {
  display: block;
}

.activity-log-summary span {
  color: var(--muted);
  font-size: 9px;
}

.activity-log-summary strong {
  margin-top: 3px;
  color: var(--accent-strong);
  font-size: 20px;
}

.activity-log-list {
  display: grid;
  max-height: min(56vh, 570px);
  gap: 8px;
  overflow-y: auto;
}

.activity-entry {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #eadfe3;
  border-radius: 15px;
  background: #fffdfc;
}

.activity-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  color: #8c405f;
  background: #fff0f5;
  font-size: 11px;
  font-weight: 900;
}

.activity-copy {
  min-width: 0;
}

.activity-copy > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.activity-copy strong {
  color: #493943;
  font-size: 11px;
}

.activity-copy span {
  overflow: hidden;
  color: #987f8b;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.activity-entry time {
  color: var(--muted-2);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .cost-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cost-detail-grid {
    grid-template-columns: 1fr;
  }

  .cost-detail-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    grid-column: 1;
  }

  .product-editor-layout {
    grid-template-columns: 1fr;
  }

  .product-editor-rail {
    position: static;
    min-height: auto;
    padding: 16px;
  }

  .editor-product-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px 18px;
    padding: 13px 15px;
  }

  .editor-product-preview > strong,
  .editor-product-preview > p,
  .editor-overline {
    grid-column: 1;
  }

  .editor-product-preview > strong {
    margin-top: 2px;
    font-size: 17px;
  }

  .editor-product-preview > p {
    margin: 0;
  }

  .editor-preview-stats {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .editor-step-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 10px;
  }

  .editor-import-note {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 74px;
    padding-inline: 14px;
  }

  .main-content {
    padding: 16px 12px 34px;
  }

  .modal-editor {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }

  .product-editor-header {
    padding: 15px 16px;
  }

  .product-editor-main {
    gap: 12px;
    padding: 12px;
  }

  .product-editor-main .form-section {
    padding: 16px;
    border-radius: 17px;
  }

  .editor-step-nav button {
    grid-template-columns: 28px minmax(0, 1fr);
    padding: 8px;
  }

  .editor-step-nav button > span {
    width: 27px;
    height: 27px;
  }

  .editor-step-nav small {
    display: none;
  }

  .formula-title-row {
    grid-template-columns: 34px 1fr;
  }

  .formula-actions {
    grid-column: 1 / -1;
    margin-top: 12px;
  }

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

  .formula-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .formula-table {
    display: block;
    min-width: 0;
  }

  .formula-table thead {
    display: none;
  }

  .formula-table tbody {
    display: grid;
    gap: 10px;
  }

  .formula-table tr {
    display: grid;
  }

  .formula-table tr[data-line-id] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 10px;
    padding: 13px;
    border: 1px solid #e5d7dd;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 9px 24px rgba(60, 35, 49, 0.04);
  }

  .formula-table tr[data-line-id] td {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 0;
    border: 0;
  }

  .formula-table tr[data-line-id] td::before {
    content: attr(data-label);
    color: #8d7c86;
    font-size: 8px;
    font-weight: 800;
  }

  .formula-table tr[data-line-id] td:nth-child(1),
  .formula-table tr[data-line-id] td:nth-child(6),
  .formula-table tr[data-line-id] td:nth-child(7),
  .formula-table tr[data-line-id] td:nth-child(8),
  .formula-table tr[data-line-id] td:nth-child(9) {
    grid-column: 1 / -1;
  }

  .formula-table tr[data-line-id] td.number,
  .formula-table tr[data-line-id] .line-cost {
    text-align: left;
  }

  .formula-item-cell,
  .formula-item-picker,
  .formula-item-picker select {
    width: 100%;
    min-width: 0;
  }

  .formula-section-row {
    display: block !important;
  }

  .formula-section-row td {
    display: block !important;
    border-radius: 12px;
  }

  .formula-section-row td strong {
    float: right;
  }

  .cost-card-hero {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 21px;
    border-radius: 18px;
  }

  .cost-card-hero-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .cost-card-metric {
    min-height: 96px;
    padding: 14px;
  }

  .cost-card-metric strong {
    font-size: 17px;
  }

  .section-cost-strip > div:last-child {
    grid-template-columns: repeat(7, 118px);
  }

  .cost-detail-side {
    grid-template-columns: 1fr;
  }

  .cost-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-log-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .activity-log-summary > div {
    padding: 11px;
  }

  .activity-entry {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .activity-entry time {
    grid-column: 2;
  }

  .responsive-product-table {
    display: block;
    min-width: 0;
    padding: 10px;
    background: #f8f3f4;
  }

  .responsive-product-table thead {
    display: none;
  }

  .responsive-product-table tbody {
    display: grid;
    gap: 10px;
  }

  .responsive-product-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow: hidden;
    border: 1px solid #e3d5db;
    border-radius: 17px;
    background: #fffdfc;
    box-shadow: 0 10px 26px rgba(62, 36, 50, 0.05);
  }

  .responsive-product-table td {
    display: grid;
    grid-template-columns: minmax(82px, auto) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 12px;
    border-bottom: 1px dashed #ede2e6;
    text-align: right !important;
  }

  .responsive-product-table td::before {
    content: attr(data-label);
    color: #8f7e87;
    font-size: 8px;
    font-weight: 800;
    text-align: left;
  }

  .responsive-product-table td.primary-cell,
  .responsive-product-table td.log-cell,
  .responsive-product-table td.actions-cell {
    grid-column: 1 / -1;
  }

  .responsive-product-table td.primary-cell {
    display: block;
    padding: 15px;
    text-align: left !important;
    background: linear-gradient(90deg, #fff8fb, #fffdfc);
  }

  .responsive-product-table td.primary-cell::before {
    display: none;
  }

  .responsive-product-table td.primary-cell strong {
    font-size: 15px;
  }

  .responsive-product-table td.log-cell {
    align-items: start;
    text-align: left !important;
  }

  .responsive-product-table td.actions-cell {
    display: block;
    border-bottom: 0;
    background: #fbf7f8;
  }

  .responsive-product-table td.actions-cell::before {
    display: none;
  }

  .responsive-product-table .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .responsive-product-table .row-button {
    width: 100%;
  }

  .responsive-product-table .row-index {
    display: none;
  }

  .latest-log span {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .compact-metrics,
  .cost-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-metric {
    min-height: 96px;
  }

  .editor-product-preview {
    grid-template-columns: 1fr;
  }

  .editor-preview-stats {
    grid-column: 1;
    grid-row: auto;
    margin-top: 8px;
  }

  .editor-step-nav button {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .editor-step-nav button div {
    display: none;
  }

  .activity-log-summary {
    gap: 6px;
  }

  .activity-log-summary strong {
    font-size: 16px;
  }

  .responsive-product-table tr {
    grid-template-columns: 1fr;
  }

  .responsive-product-table td {
    grid-column: 1 / -1;
  }
}

/* v5.1 — 完整功能核对与常见桌面宽度可见性修复 */
.feature-check-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -2px 0 16px;
  padding: 11px 14px;
  border: 1px solid rgba(151, 71, 107, 0.16);
  border-radius: 14px;
  color: #6f5360;
  background: linear-gradient(90deg, rgba(255, 246, 249, 0.96), rgba(255, 253, 251, 0.96));
  box-shadow: 0 8px 24px rgba(77, 42, 59, 0.04);
  font-size: 10px;
  font-weight: 760;
}

.feature-check-strip > span:not(.feature-check-title) {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #eadde2;
  border-radius: 999px;
  background: #fff;
  white-space: nowrap;
}

.feature-check-title {
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.latest-log time {
  color: #9a8791;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.formula-source-code {
  display: block;
  max-width: 260px;
  margin-top: 4px;
  overflow: hidden;
  color: #765565;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-button.primary-action {
  border-color: rgba(151, 71, 107, 0.25);
  color: #fff;
  background: var(--accent-strong);
}

.row-button.primary-action:hover {
  color: #fff;
  background: #7d3153;
}

/* 在常见笔记本和桌面宽度下改为档案卡，避免日志、更新时间和操作被横向藏住。 */
@media (min-width: 761px) and (max-width: 1900px) {
  #productsTableContainer,
  #costsTableContainer {
    overflow: visible;
  }

  .responsive-product-table,
  .responsive-cost-table {
    display: block;
    min-width: 0;
    padding: 14px;
    background: #f8f3f4;
  }

  .responsive-product-table thead,
  .responsive-cost-table thead {
    display: none;
  }

  .responsive-product-table tbody,
  .responsive-cost-table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 13px;
  }

  .responsive-product-table tr,
  .responsive-cost-table tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #e4d7dc;
    border-radius: 18px;
    background: #fffdfc;
    box-shadow: 0 12px 30px rgba(62, 36, 50, 0.055);
  }

  .responsive-product-table td,
  .responsive-cost-table td {
    display: grid;
    min-width: 0;
    min-height: 62px;
    align-content: center;
    gap: 5px;
    padding: 10px 12px;
    border-right: 1px dashed #eee3e7;
    border-bottom: 1px dashed #eee3e7;
    text-align: left !important;
    white-space: normal;
  }

  .responsive-product-table td::before,
  .responsive-cost-table td::before {
    content: attr(data-label);
    color: #9a8791;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.04em;
  }

  .responsive-product-table td.primary-cell,
  .responsive-product-table td.log-cell,
  .responsive-product-table td.actions-cell,
  .responsive-cost-table td.primary-cell,
  .responsive-cost-table td.actions-cell {
    grid-column: 1 / -1;
  }

  .responsive-product-table td.primary-cell,
  .responsive-cost-table td.primary-cell {
    display: block;
    min-height: 80px;
    padding: 16px;
    background: linear-gradient(90deg, #fff7fa, #fffdfc);
  }

  .responsive-product-table td.primary-cell::before,
  .responsive-cost-table td.primary-cell::before,
  .responsive-product-table td.actions-cell::before,
  .responsive-cost-table td.actions-cell::before {
    display: none;
  }

  .responsive-product-table td.primary-cell strong,
  .responsive-cost-table td.primary-cell strong {
    font-size: 15px;
  }

  .responsive-product-table td.log-cell {
    min-height: 88px;
    background: #fffbfc;
  }

  .responsive-product-table td.actions-cell,
  .responsive-cost-table td.actions-cell {
    display: block;
    min-height: auto;
    border-bottom: 0;
    background: #faf5f7;
  }

  .responsive-product-table .row-actions,
  .responsive-cost-table .row-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
    gap: 8px;
  }

  .responsive-product-table .row-button,
  .responsive-cost-table .row-button {
    width: 100%;
    min-height: 34px;
  }

  .responsive-product-table .row-index {
    display: none;
  }

  .responsive-product-table .number,
  .responsive-cost-table .number {
    text-align: left !important;
  }

  .responsive-product-table .latest-log,
  .responsive-cost-table .latest-log {
    min-width: 0;
  }

  .responsive-product-table .latest-log span {
    max-width: 100%;
    white-space: normal;
  }
}

@media (min-width: 1901px) {
  .product-table th:last-child,
  .product-table td:last-child,
  .cost-table th:last-child,
  .cost-table td:last-child {
    position: sticky;
    right: 0;
    z-index: 4;
    background: #fffdfc;
    box-shadow: -10px 0 18px rgba(63, 36, 50, 0.05);
  }

  .product-table th:last-child,
  .cost-table th:last-child {
    z-index: 6;
    background: #f8fafc;
  }
}

@media (max-width: 760px) {
  .feature-check-strip {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 10px;
    scrollbar-width: thin;
  }

  .feature-check-strip > span {
    flex: 0 0 auto;
  }

  .formula-source-code {
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
  }
}

/* v6.0 — 智能筛选、批量维护、AI 配方识别与参数作用范围 */
.overview-jump-card {
  appearance: none;
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.overview-jump-card:hover {
  transform: translateY(-2px);
  border-color: #d8bdc9;
  box-shadow: 0 16px 36px rgba(88, 47, 66, 0.10);
}

.overview-jump-card:focus-visible {
  outline: 3px solid rgba(155, 70, 104, 0.20);
  outline-offset: 3px;
}

.advanced-toolbar {
  align-items: flex-start;
  padding-block: 17px;
}

.filter-stack {
  display: grid;
  min-width: min(100%, 640px);
  flex: 1 1 660px;
  gap: 10px;
}

.range-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.price-range-filter {
  display: grid;
  grid-template-columns: auto minmax(86px, 112px) auto minmax(86px, 112px);
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 5px 8px 5px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfc;
}

.price-range-filter > span {
  color: #715c66;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.price-range-filter > i {
  color: var(--muted-2);
  font-style: normal;
}

.price-range-filter input {
  width: 100%;
  min-height: 29px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: #faf6f7;
  font-size: 11px;
}

.price-range-filter input:focus {
  box-shadow: 0 0 0 2px rgba(155, 70, 104, 0.13);
}

.button.text {
  min-height: 36px;
  padding-inline: 10px;
  border-color: transparent;
  color: var(--accent-strong);
  background: transparent;
  box-shadow: none;
}

.button.text:hover {
  border-color: #ead8e0;
  background: #fff7fa;
}

.bulk-toolbar-actions {
  align-items: center;
}

.product-library-panel .advanced-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.product-library-panel .filter-stack {
  width: 100%;
  min-width: 0;
  flex-basis: auto;
}

.product-library-panel .filter-row {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(320px, 480px) minmax(180px, 220px) minmax(150px, 180px);
  justify-content: start;
}

.product-library-panel .filter-row .search-box,
.product-library-panel .filter-row .select-control {
  width: 100%;
  min-width: 0;
}

.product-library-panel .range-filter-row {
  display: grid;
  grid-template-columns: minmax(292px, max-content) minmax(292px, max-content) auto;
  justify-content: start;
}

.product-library-panel .bulk-toolbar-actions {
  width: 100%;
  max-width: none;
  justify-content: flex-start;
}

.selection-summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #ead7df;
  border-radius: 999px;
  color: #83546a;
  background: #fff7fa;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.selectable-table .select-cell {
  width: 48px;
  min-width: 48px;
  text-align: center;
}

.selectable-table input[type="checkbox"],
.bulk-field > input[type="checkbox"],
.scope-choice-list input[type="radio"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.data-table tr.selected-row > td {
  background: #fff7fa;
}

.data-table tr.selected-row > td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.table-sort-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ai-button {
  border-color: #7359aa;
  color: #fff;
  background: linear-gradient(135deg, #7764bd, #97476f);
  box-shadow: 0 9px 22px rgba(106, 78, 154, 0.20);
}

.ai-button:hover {
  transform: translateY(-1px);
  color: #fff;
  background: linear-gradient(135deg, #846fc9, #a24f79);
  box-shadow: 0 12px 28px rgba(106, 78, 154, 0.28);
}

.formula-item-picker {
  position: relative;
}

.formula-suggestion-list {
  display: grid;
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid #e4d2da;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(64, 39, 52, 0.12);
}

.formula-suggestion-list button {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #f0e6ea;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.formula-suggestion-list button:last-child {
  border-bottom: 0;
}

.formula-suggestion-list button:hover {
  background: #fff5f8;
}

.formula-suggestion-list button span,
.formula-suggestion-list button strong,
.formula-suggestion-list button small {
  display: block;
  min-width: 0;
}

.formula-suggestion-list button strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.formula-suggestion-list button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.formula-suggestion-list button b {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 9px;
  white-space: nowrap;
}

.formula-suggestion-list.empty {
  padding: 10px;
  color: var(--muted);
  background: #faf7f8;
  font-size: 9px;
}

.ai-formula-body {
  padding: 18px;
  background: #f9f5f6;
}

.ai-import-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  gap: 16px;
}

.ai-input-panel,
.ai-result-panel {
  min-width: 0;
  padding: 17px;
  border: 1px solid #e4d5dc;
  border-radius: 18px;
  background: #fffdfc;
  box-shadow: 0 12px 30px rgba(64, 39, 52, 0.05);
}

.ai-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-panel-heading strong,
.ai-panel-heading span {
  display: block;
}

.ai-panel-heading strong {
  font-size: 14px;
}

.ai-panel-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

#aiFormulaInput {
  width: 100%;
  min-height: 280px;
  padding: 13px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  outline: 0;
  color: var(--text);
  background: #fcf9fa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.8;
}

.ai-input-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
}

.ai-input-tools select {
  min-width: 150px;
  min-height: 40px;
  flex: 1;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.privacy-note {
  margin: 10px 0 0;
  color: #83727a;
  font-size: 9px;
}

.ai-results-empty {
  display: grid;
  min-height: 336px;
  place-items: center;
  align-content: center;
  padding: 24px;
  border: 1px dashed #dbc7d0;
  border-radius: 14px;
  color: var(--muted);
  background: #fcf9fa;
  text-align: center;
}

.ai-results-empty > span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, #7764bd, #97476f);
  font-size: 13px;
  font-weight: 950;
}

.ai-results-empty strong {
  color: var(--text);
  font-size: 14px;
}

.ai-results-empty p {
  max-width: 320px;
  margin: 5px 0 0;
  font-size: 10px;
}

.ai-results-table-wrap {
  max-height: 500px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.ai-result-table {
  min-width: 1080px;
}

.ai-result-table select,
.ai-result-table input {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 9px;
}

.ai-result-table td:nth-child(2) {
  min-width: 290px;
}

.match-confidence {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.match-confidence.high {
  color: #26765f;
  background: var(--green-soft);
}

.match-confidence.medium {
  color: #946015;
  background: var(--amber-soft);
}

.match-confidence.low {
  color: #a33b4e;
  background: var(--red-soft);
}

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

.bulk-field {
  display: grid;
  grid-template-columns: 20px minmax(120px, 0.65fr) minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf8f9;
  transition: 140ms ease;
}

.bulk-field.enabled {
  border-color: #d7b9c6;
  background: #fff8fb;
  box-shadow: inset 3px 0 0 var(--accent);
}

.bulk-field > span {
  color: #67565e;
  font-size: 10px;
  font-weight: 850;
}

.bulk-field input:not([type="checkbox"]),
.bulk-field select {
  width: 100%;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.bulk-field input:disabled,
.bulk-field select:disabled {
  color: #aa9ca4;
  background: #f1edef;
  cursor: not-allowed;
}

.bulk-delivery-controls,
.bulk-mode-cost-controls,
.bulk-quote-controls {
  display: grid;
  gap: 7px;
}

.bulk-delivery-controls,
.bulk-mode-cost-controls {
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.8fr);
}

.bulk-quote-controls {
  grid-template-columns: repeat(3, minmax(90px, 1fr));
}

.scope-choice-list {
  display: grid;
  gap: 10px;
}

.scope-choice-list > label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdfc;
  cursor: pointer;
  transition: 140ms ease;
}

.scope-choice-list > label:hover,
.scope-choice-list > label:has(input:checked) {
  border-color: #d4b1c0;
  background: #fff6fa;
  box-shadow: inset 3px 0 0 var(--accent);
}

.scope-choice-list > label.disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.scope-choice-list span,
.scope-choice-list strong,
.scope-choice-list small {
  display: block;
}

.scope-choice-list strong {
  font-size: 12px;
}

.scope-choice-list small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.settings-change-preview {
  display: grid;
  gap: 6px;
  margin-top: 15px;
  padding: 12px;
  border: 1px solid #e6d6dd;
  border-radius: 14px;
  background: #faf6f8;
}

.settings-change-preview > div {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto 18px auto;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  font-size: 9px;
}

.settings-change-preview span {
  color: var(--muted);
}

.settings-change-preview del {
  color: #a28e98;
}

.settings-change-preview b {
  color: #b28b9e;
  text-align: center;
}

.settings-change-preview strong {
  color: var(--accent-strong);
  text-align: right;
}

@media (min-width: 761px) and (max-width: 1900px) {
  .responsive-product-table tr,
  .responsive-cost-table tr {
    position: relative;
  }

  .responsive-product-table td.select-cell,
  .responsive-cost-table td.select-cell {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: grid;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    place-items: center;
    padding: 0;
    border: 1px solid #e3d0d8;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(71, 40, 55, 0.08);
  }

  .responsive-product-table td.select-cell::before,
  .responsive-cost-table td.select-cell::before {
    display: none;
  }

  .responsive-product-table td.primary-cell,
  .responsive-cost-table td.primary-cell {
    padding-right: 64px;
  }
}

@media (max-width: 1180px) {
  .ai-import-grid {
    grid-template-columns: 1fr;
  }

  #aiFormulaInput {
    min-height: 210px;
  }

  .bulk-edit-grid {
    grid-template-columns: 1fr;
  }

  .product-library-panel .advanced-toolbar {
    grid-template-columns: 1fr;
  }

  .product-library-panel .bulk-toolbar-actions {
    max-width: none;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .advanced-toolbar,
  .filter-stack,
  .range-filter-row,
  .bulk-toolbar-actions {
    width: 100%;
  }

  .product-library-panel .advanced-toolbar,
  .product-library-panel .filter-row,
  .product-library-panel .range-filter-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filter-row > .search-box,
  .filter-row > .select-control {
    width: 100%;
    min-width: 0;
  }

  .price-range-filter {
    width: 100%;
    grid-template-columns: 82px minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .bulk-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bulk-toolbar-actions .selection-summary,
  .bulk-toolbar-actions .basis-chip {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .bulk-toolbar-actions .button {
    width: 100%;
  }

  .table-sort-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .responsive-product-table td.select-cell,
  .responsive-cost-table td.select-cell {
    position: absolute;
    top: 13px;
    right: 13px;
    z-index: 4;
    display: grid;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    place-items: center;
    padding: 0;
    border: 1px solid #e3d0d8;
    border-radius: 10px;
    background: #fff;
  }

  .responsive-product-table tr,
  .responsive-cost-table tr {
    position: relative;
  }

  .responsive-product-table td.select-cell::before,
  .responsive-cost-table td.select-cell::before {
    display: none;
  }

  .responsive-product-table td.primary-cell,
  .responsive-cost-table td.primary-cell {
    padding-right: 60px;
  }

  .ai-formula-body,
  .ai-input-panel,
  .ai-result-panel {
    padding: 11px;
  }

  .ai-panel-heading,
  .ai-input-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-input-tools .button,
  .ai-input-tools select {
    width: 100%;
  }

  .bulk-field {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .bulk-field > span {
    grid-column: 2;
  }

  .bulk-field > :last-child {
    grid-column: 1 / -1;
  }

  .bulk-delivery-controls,
  .bulk-mode-cost-controls,
  .bulk-quote-controls {
    grid-template-columns: 1fr;
  }

  .settings-change-preview > div {
    grid-template-columns: minmax(90px, 1fr) auto 14px auto;
  }
}

@media (max-width: 480px) {
  .overview-jump-card {
    padding: 15px;
  }

  .overview-jump-card .metric-icon {
    width: 40px;
    height: 40px;
  }

  .overview-jump-card strong {
    font-size: 22px;
  }

  .price-range-filter {
    grid-template-columns: 1fr 1fr;
  }

  .price-range-filter > span {
    grid-column: 1 / -1;
  }

  .price-range-filter > i {
    display: none;
  }

  .scope-choice-list > label {
    padding: 11px;
  }

  .settings-change-preview > div {
    grid-template-columns: 1fr auto;
  }

  .settings-change-preview del,
  .settings-change-preview b {
    display: none;
  }
}

/* v6.0 — automatic cost parameter application controls */
.settings-apply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 18px 18px;
  padding: 12px 14px;
  border: 1px solid #e6d5dd;
  border-radius: 14px;
  color: var(--muted);
  background: #faf6f8;
  font-size: 10px;
  font-weight: 750;
}

#settingsDirtyHint.dirty {
  color: #8c3f61;
  font-weight: 900;
}

#applySettingsBtn.attention {
  animation: settingsAttention 1.6s ease-in-out infinite;
  box-shadow: 0 0 0 4px rgba(155, 70, 104, 0.12), 0 10px 22px rgba(95, 53, 72, 0.17);
}

@keyframes settingsAttention {
  0%, 100% { box-shadow: 0 0 0 3px rgba(155, 70, 104, 0.08), 0 10px 22px rgba(95, 53, 72, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(155, 70, 104, 0.14), 0 12px 26px rgba(95, 53, 72, 0.21); }
}

@media (max-width: 760px) {
  .settings-apply-bar {
    align-items: stretch;
    flex-direction: column;
    margin-inline: 12px;
  }

  .settings-apply-bar .button {
    width: 100%;
  }
}

/* v6.0 — dashboard hero contrast correction */
.hero-panel {
  color: #fff;
  border-color: rgba(119, 52, 82, 0.28);
  background:
    radial-gradient(circle at 87% 16%, rgba(236, 173, 201, 0.3), transparent 24rem),
    radial-gradient(circle at 12% 110%, rgba(255, 215, 228, 0.13), transparent 25rem),
    linear-gradient(132deg, #4b263a 0%, #783750 52%, #ad5276 100%);
  box-shadow: 0 24px 58px rgba(87, 39, 61, 0.22);
}

.hero-panel .hero-kicker {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.1);
}

.hero-panel h2,
.hero-panel .health-card strong {
  color: #fff;
}

.hero-panel p,
.hero-panel .health-card span {
  color: rgba(255, 255, 255, 0.78);
}

.hero-panel .health-card {
  border-color: rgba(255, 255, 255, 0.17);
  background: rgba(38, 14, 27, 0.24);
}

.hero-panel .health-ring::before {
  background: #71334f;
}

.hero-panel::after {
  border-color: rgba(255, 255, 255, 0.08);
}

/* ========================================================================== 
   v6.3 base — Apple iOS inspired visual system + image records
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-soft: #f7f7fa;
  --sidebar: rgba(255, 255, 255, 0.86);
  --sidebar-soft: #f2f2f7;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --muted-2: #8e8e93;
  --line: rgba(60, 60, 67, 0.14);
  --line-strong: rgba(60, 60, 67, 0.22);
  --accent: #007aff;
  --accent-strong: #0066d6;
  --accent-soft: #eaf4ff;
  --green: #248a3d;
  --green-soft: #ebf8ee;
  --amber: #c93400;
  --amber-soft: #fff3e8;
  --red: #d70015;
  --red-soft: #fff0f1;
  --blue: #007aff;
  --blue-soft: #eaf4ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(0, 0, 0, 0.035);
  --shadow-md: 0 10px 34px rgba(15, 23, 42, 0.075);
  --shadow-lg: 0 28px 90px rgba(15, 23, 42, 0.18);
  --radius: 22px;
  --radius-sm: 14px;
}

html,
body {
  background:
    radial-gradient(circle at 92% 3%, rgba(10, 132, 255, 0.08), transparent 28rem),
    radial-gradient(circle at 2% 98%, rgba(90, 200, 250, 0.08), transparent 26rem),
    var(--bg);
}

body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: -0.006em;
}

::selection {
  color: #fff;
  background: rgba(0, 122, 255, 0.82);
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  width: 248px;
  padding: 20px 14px 17px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  box-shadow: 10px 0 38px rgba(15, 23, 42, 0.035);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
}

.workspace {
  grid-column: 2;
}

.brand-block {
  padding: 4px 7px 23px;
}

.brand-mark {
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  color: #4b3700;
  background: linear-gradient(145deg, #fff7d6 0%, #ffd96a 55%, #f7bd28 100%);
  box-shadow: 0 9px 24px rgba(186, 129, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.brand-copy strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 750;
}

.brand-copy span {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-label {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.nav-item,
.sidebar-tool {
  min-height: 46px;
  border-radius: 13px;
  color: #4a4a4f;
  font-weight: 650;
}

.nav-item:hover,
.sidebar-tool:hover {
  color: var(--text);
  background: rgba(118, 118, 128, 0.09);
}

.nav-item.active {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(0, 122, 255, 0.13), rgba(0, 122, 255, 0.055));
  border-color: rgba(0, 122, 255, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-count,
.nav-item.active .nav-count {
  color: var(--accent);
  background: rgba(0, 122, 255, 0.1);
}

.sidebar-tool {
  border-color: var(--line);
  background: rgba(118, 118, 128, 0.055);
}

.sidebar-footer {
  border-top-color: var(--line);
  color: var(--muted);
}

.sidebar-footer small {
  color: var(--muted-2);
}

.save-dot {
  background: #34c759;
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.12);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  min-height: 90px;
  padding: 17px clamp(18px, 2.5vw, 34px);
  background: rgba(246, 246, 249, 0.78);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
}

.topbar h1 {
  color: var(--text);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 760;
  letter-spacing: -0.035em;
}

.eyebrow,
.section-kicker,
.hero-kicker,
.editor-overline,
.cost-card-overline {
  color: var(--accent);
  font-weight: 750;
  letter-spacing: 0.13em;
}

.page-description {
  color: var(--muted);
}

.content {
  padding: clamp(18px, 2.5vw, 34px);
}

.panel,
.metric-card,
.mini-metric,
.table-panel,
.form-section,
.cost-detail-panel,
.quote-section,
.data-action-card,
.scope-choice-list > label,
.bulk-field {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.panel,
.table-panel,
.form-section,
.cost-detail-panel,
.quote-section {
  border-radius: var(--radius);
}

.metric-card,
.mini-metric,
.data-action-card,
.scope-choice-list > label,
.bulk-field {
  border-radius: 18px;
}

.metric-card:hover,
.data-action-card:hover,
.overview-jump-card:hover {
  border-color: rgba(0, 122, 255, 0.2);
  box-shadow: 0 15px 38px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}

.hero-panel {
  color: var(--text);
  border: 1px solid rgba(0, 122, 255, 0.12);
  background:
    radial-gradient(circle at 93% 12%, rgba(90, 200, 250, 0.24), transparent 22rem),
    radial-gradient(circle at 73% 105%, rgba(0, 122, 255, 0.12), transparent 28rem),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.94));
  box-shadow: 0 18px 54px rgba(15, 23, 42, 0.08);
}

.hero-panel::after {
  border-color: rgba(0, 122, 255, 0.08);
}

.hero-panel h2,
.hero-panel .health-card strong {
  color: var(--text);
}

.hero-panel p,
.hero-panel .health-card span {
  color: var(--muted);
}

.hero-panel .hero-kicker {
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.16);
  background: rgba(0, 122, 255, 0.08);
}

.hero-panel .health-card {
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
}

.hero-panel .health-ring::before {
  background: #f4f8fd;
}

.health-ring {
  color: var(--accent);
}

.button {
  border-radius: 12px;
  font-weight: 680;
  letter-spacing: -0.01em;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease, border-color 140ms ease;
}

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

.button.primary,
.button.ai-button,
.row-button.primary-action {
  color: #fff;
  border-color: rgba(0, 102, 214, 0.28);
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  box-shadow: 0 7px 18px rgba(0, 122, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.button.primary:hover,
.button.ai-button:hover,
.row-button.primary-action:hover {
  color: #fff;
  background: linear-gradient(180deg, #168cff 0%, #006fe8 100%);
  box-shadow: 0 10px 22px rgba(0, 122, 255, 0.26);
}

.button.secondary,
.button.ghost,
.button.light,
.row-button {
  color: var(--accent);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.025);
}

.button.secondary:hover,
.button.ghost:hover,
.row-button:hover {
  color: var(--accent-strong);
  border-color: rgba(0, 122, 255, 0.2);
  background: #fff;
}

.button.text,
.link-button,
.inline-log-button {
  color: var(--accent);
}

.button.danger,
.row-button.danger {
  color: var(--red);
  border-color: rgba(215, 0, 21, 0.14);
  background: var(--red-soft);
}

input,
select,
textarea,
.search-box,
.input-prefix,
.input-suffix {
  border-color: transparent;
  border-radius: 12px;
  color: var(--text);
  background: rgba(118, 118, 128, 0.085);
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, 0.045);
}

input::placeholder,
textarea::placeholder {
  color: #a1a1a6;
}

input:focus,
select:focus,
textarea:focus,
.search-box:focus-within {
  border-color: rgba(0, 122, 255, 0.5) !important;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12), inset 0 0 0 1px rgba(0, 122, 255, 0.2);
}

.auto-field {
  color: var(--muted);
  background: rgba(118, 118, 128, 0.055);
}

.section-tabs {
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(118, 118, 128, 0.08);
}

.section-tab {
  border-radius: 10px;
  color: var(--muted);
}

.section-tab.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.feature-check-strip,
.table-sort-note,
.settings-apply-bar,
.settings-change-preview {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
}

.table-container {
  border-radius: 0 0 var(--radius) var(--radius);
}

.data-table {
  color: var(--text);
}

.data-table th,
.data-table td {
  border-bottom-color: rgba(60, 60, 67, 0.1);
}

.data-table th,
.data-table thead th {
  color: var(--muted);
  background: rgba(247, 247, 249, 0.96);
  font-weight: 720;
  letter-spacing: 0.015em;
}

.data-table tbody tr:hover {
  background: rgba(0, 122, 255, 0.035);
}

.data-table tr.selected-row > td {
  background: rgba(0, 122, 255, 0.075) !important;
}

.data-table tr.selected-row > td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.primary-cell strong {
  color: var(--text);
  font-weight: 700;
}

.primary-cell span,
.primary-cell small,
.price-sub,
.field-help {
  color: var(--muted);
}

.price-main {
  color: var(--text);
}

.price-chip,
.size-chip,
.basis-chip,
.pill,
.status-badge {
  border-radius: 999px;
}

.price-chip,
.size-chip,
.pill.accent {
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.14);
  background: var(--accent-soft);
}

.status-badge.complete,
.status-badge.active {
  color: #248a3d;
  background: #eaf8ed;
}

.status-badge.warning {
  color: #b54708;
  background: #fff4e5;
}

.status-badge.archived,
.status-badge.missing {
  color: var(--muted);
  background: rgba(118, 118, 128, 0.1);
}

.modal-backdrop {
  background: rgba(18, 18, 20, 0.32);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.modal {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  background: rgba(250, 250, 252, 0.96);
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.24);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.modal-header h2,
.form-section-title h3,
.panel-heading h3,
.quote-heading h3,
.cost-panel-heading h3 {
  color: var(--text);
  font-weight: 730;
  letter-spacing: -0.022em;
}

.icon-button {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(118, 118, 128, 0.08);
}

.icon-button:hover {
  color: var(--text);
  background: rgba(118, 118, 128, 0.14);
}

.product-editor-rail {
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 247, 252, 0.92));
}

.editor-product-preview,
.editor-import-note,
.editor-step-nav button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.editor-step-nav button:hover {
  border-color: rgba(0, 122, 255, 0.2);
  background: #fff;
}

.editor-step-nav button > span,
.form-section-title > span {
  color: var(--accent);
  background: var(--accent-soft);
}

.formula-preview,
.quote-stats,
.cost-breakdown,
.scope-choice-list,
.data-summary {
  border-color: var(--line);
  background: rgba(118, 118, 128, 0.055);
}

.formula-section-row td,
.cost-section-row td {
  color: var(--accent-strong);
  background: #edf6ff !important;
}

.formula-suggestion-list {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.formula-suggestion-list button:hover {
  background: var(--accent-soft);
}

.cost-card-hero {
  border-color: rgba(0, 122, 255, 0.14);
  background:
    radial-gradient(circle at 90% 12%, rgba(90, 200, 250, 0.22), transparent 18rem),
    linear-gradient(145deg, #ffffff 0%, #eef7ff 100%);
  color: var(--text);
}

.cost-card-hero h3 {
  color: var(--text);
}

.cost-card-hero p,
.cost-card-hero-actions > span {
  color: var(--muted);
}

.cost-card-metric.accent {
  border-color: rgba(0, 122, 255, 0.2);
  background: var(--accent-soft);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.18);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

.toast-mark {
  color: #fff;
  background: var(--accent);
}

/* Image records ---------------------------------------------------------- */
.image-cell {
  width: 76px;
  min-width: 76px;
  text-align: center !important;
}

.record-image-button,
.image-upload-surface {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(60, 60, 67, 0.12);
  color: var(--accent);
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.92), transparent 42%),
    linear-gradient(145deg, #f8f8fa, #e9eef6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 5px 16px rgba(15, 23, 42, 0.08);
  cursor: pointer;
}

.record-image-button {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  border-radius: 16px;
}

.record-image-button:hover,
.image-upload-surface:hover {
  border-color: rgba(0, 122, 255, 0.34);
  box-shadow: 0 9px 24px rgba(0, 122, 255, 0.12);
  transform: translateY(-1px);
}

.record-image-button img,
.image-upload-surface img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record-image-placeholder,
.image-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--accent);
  font-size: 20px;
  font-weight: 760;
}

.record-image-button.has-image .record-image-placeholder,
.image-upload-surface.has-image .image-placeholder {
  opacity: 0;
}

.record-image-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  color: #fff;
  background: rgba(0, 122, 255, 0.94);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.record-image-badge svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

.editor-image-card {
  display: grid;
  gap: 10px;
  margin-bottom: 17px;
}

.image-upload-surface {
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 24px;
}

.image-upload-surface-lg {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}

.image-upload-overlay {
  position: absolute;
  inset: auto 7px 7px;
  z-index: 2;
  display: grid;
  gap: 1px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 11px;
  color: #fff;
  background: rgba(20, 20, 24, 0.56);
  text-align: left;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.image-upload-overlay b {
  font-size: 10px;
  font-weight: 720;
}

.image-upload-overlay small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 8px;
}

.image-upload-surface:not(.has-image) .image-upload-overlay {
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

.image-upload-surface:not(.has-image) .image-upload-overlay small {
  color: var(--muted);
}

.image-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.image-editor-actions .button {
  min-height: 32px;
}

.image-editor-actions .button:disabled {
  opacity: 0.38;
}

.item-image-editor {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.item-image-copy {
  display: grid;
  flex: 1;
  gap: 5px;
}

.item-image-copy strong {
  color: var(--text);
  font-size: 14px;
}

.item-image-copy > span {
  color: var(--muted);
  font-size: 11px;
}

.cost-card-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 15px;
}

.cost-card-product-image .record-image-button {
  width: 78px;
  height: 78px;
  margin: 0;
  border-radius: 22px;
}

/* Cards used for product and cost libraries on desktop ------------------ */
@media (min-width: 761px) and (max-width: 1900px) {
  .responsive-product-table,
  .responsive-cost-table {
    background: transparent;
  }

  .responsive-product-table tbody,
  .responsive-cost-table tbody {
    grid-template-columns: repeat(auto-fit, minmax(510px, 1fr));
    gap: 14px;
  }

  .responsive-product-table tr,
  .responsive-cost-table tr {
    border-color: var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
  }

  .responsive-product-table td,
  .responsive-cost-table td {
    border-right-color: rgba(60, 60, 67, 0.09);
    border-bottom-color: rgba(60, 60, 67, 0.09);
  }

  .responsive-product-table td::before,
  .responsive-cost-table td::before {
    color: var(--muted-2);
  }

  .responsive-product-table td.image-cell,
  .responsive-cost-table td.image-cell {
    grid-column: span 1;
    display: grid;
    min-width: 0;
    min-height: 92px;
    place-items: center;
    padding: 12px;
  }

  .responsive-product-table td.image-cell::before,
  .responsive-cost-table td.image-cell::before {
    display: none;
  }

  .responsive-product-table td.primary-cell,
  .responsive-cost-table td.primary-cell {
    grid-column: span 3;
    min-height: 92px;
    padding: 17px;
    background: linear-gradient(90deg, rgba(245, 249, 255, 0.95), rgba(255, 255, 255, 0.94));
  }

  .responsive-product-table td.log-cell {
    background: rgba(249, 249, 251, 0.84);
  }

  .responsive-product-table td.actions-cell,
  .responsive-cost-table td.actions-cell {
    background: rgba(247, 247, 249, 0.92);
  }

  .responsive-product-table td.select-cell,
  .responsive-cost-table td.select-cell {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.08);
  }
}

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

  .workspace {
    min-width: 0;
  }

  .sidebar {
    width: min(86vw, 320px);
    box-shadow: 22px 0 70px rgba(15, 23, 42, 0.2);
  }

  .topbar {
    min-height: 78px;
    padding: 13px 14px;
  }

  .content {
    padding: 14px;
  }

  .responsive-product-table,
  .responsive-cost-table {
    background: transparent;
  }

  .responsive-product-table tr,
  .responsive-cost-table tr {
    border-color: var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
  }

  .responsive-product-table td,
  .responsive-cost-table td {
    border-bottom-color: rgba(60, 60, 67, 0.09);
  }

  .responsive-product-table td.image-cell,
  .responsive-cost-table td.image-cell {
    grid-column: 1 / -1;
    display: block;
    min-height: 0;
    padding: 14px 14px 0;
    border-bottom: 0;
    text-align: left !important;
  }

  .responsive-product-table td.image-cell::before,
  .responsive-cost-table td.image-cell::before {
    display: none;
  }

  .responsive-product-table td.image-cell .record-image-button,
  .responsive-cost-table td.image-cell .record-image-button {
    width: 76px;
    height: 76px;
    margin: 0;
    border-radius: 20px;
  }

  .responsive-product-table td.primary-cell,
  .responsive-cost-table td.primary-cell {
    padding-top: 12px;
    background: linear-gradient(90deg, rgba(245, 249, 255, 0.9), rgba(255, 255, 255, 0.94));
  }

  .responsive-product-table td.actions-cell,
  .responsive-cost-table td.actions-cell {
    background: rgba(247, 247, 249, 0.92);
  }

  .responsive-product-table td.select-cell,
  .responsive-cost-table td.select-cell {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.94);
  }

  .item-image-editor {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-upload-surface {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .image-editor-actions {
    width: 100%;
  }

  .image-editor-actions .button {
    flex: 1;
  }

  .cost-card-identity {
    align-items: flex-start;
  }

  .cost-card-product-image .record-image-button {
    width: 64px;
    height: 64px;
    border-radius: 18px;
  }
}

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

/* Final iOS color normalization ----------------------------------------- */
.hero-panel .button.text-light {
  color: var(--accent);
  border-color: rgba(0, 122, 255, 0.14);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.025);
}

.hero-panel .button.text-light:hover {
  color: var(--accent-strong);
  border-color: rgba(0, 122, 255, 0.24);
  background: #fff;
}

.flow-node:hover {
  border-color: rgba(0, 122, 255, 0.24);
  box-shadow: 0 12px 25px rgba(0, 122, 255, 0.09);
}

.flow-node.result {
  border-color: rgba(0, 102, 214, 0.24);
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.2);
}

.toast.success,
.toast.error,
.toast.warning {
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
}

.toast strong {
  color: var(--text);
}

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

.toast.success .toast-mark { background: #34c759; }
.toast.error .toast-mark { background: #ff3b30; }
.toast.warning .toast-mark { background: #ff9f0a; }

/* Editor and AI surfaces use the same neutral iOS palette ---------------- */
.modal-editor {
  border-color: rgba(60, 60, 67, 0.14);
  background: rgba(250, 250, 252, 0.98);
}

.product-editor-header {
  background: rgba(255, 255, 255, 0.78);
}

.product-modal-body,
.ai-formula-body {
  background: rgba(242, 242, 247, 0.78);
}

.product-editor-main .form-section,
.ai-input-panel,
.ai-result-panel {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
}

.editor-product-preview > strong,
.editor-preview-stats b,
.editor-step-nav strong {
  color: var(--text);
}

.editor-product-preview > p,
.editor-preview-stats span,
.editor-step-nav small,
.editor-import-note p {
  color: var(--muted);
}

.editor-overline,
.editor-import-note span {
  color: var(--accent);
}

.editor-step-nav button {
  color: var(--muted);
}

#aiFormulaInput,
.ai-results-empty {
  border-color: var(--line);
  background: rgba(247, 247, 249, 0.92);
}

.ai-results-empty {
  border-color: rgba(60, 60, 67, 0.2);
}

.ai-results-empty > span {
  background: linear-gradient(180deg, #0a84ff 0%, #007aff 100%);
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.2);
}

.privacy-note {
  color: var(--muted);
}

/* Amount formula inputs -------------------------------------------------- */
.formula-input-shell {
  position: relative;
  padding-right: 36px;
}

.formula-input-shell > input {
  padding-right: 38px !important;
}

.amount-fx-button {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 9px;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.11);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.amount-fx-button:hover {
  background: rgba(0, 122, 255, 0.18);
  transform: translateY(-50%) scale(1.04);
}

.amount-fx-button:disabled,
.auto-field + .amount-fx-button {
  opacity: 0.45;
}

.amount-formula-input.is-formula {
  color: #0057b8;
  background: rgba(0, 122, 255, 0.045);
}

.amount-formula-input.formula-error {
  border-color: rgba(255, 59, 48, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1) !important;
}

.formula-field-help {
  min-height: 16px;
}

.formula-field-help.formula-ok {
  color: #248a3d;
}

.formula-field-help.formula-error {
  color: #d70015;
}

.formula-field-help code,
.formula-result-note code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(60, 60, 67, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.quote-price-formula {
  display: grid;
  gap: 5px;
  min-width: 190px;
}

.quote-price-formula .input-prefix {
  position: relative;
  padding-right: 34px;
}

.quote-price-formula small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.quote-price-formula small.error {
  color: #d70015;
}

.formula-fixed-input {
  position: relative;
  min-width: 0;
  padding-right: 34px;
}

.formula-fixed-input input {
  padding-right: 34px !important;
}

.formula-fixed-input .amount-fx-button {
  right: 4px;
}

.formula-result-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.formula-result-note.error {
  color: #d70015;
}

.formula-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #0057b8;
  background: rgba(0, 122, 255, 0.11);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.amount-formula-modal .modal-body {
  display: grid;
  gap: 18px;
}

.amount-formula-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.amount-formula-guide > div {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(247, 247, 249, 0.88);
}

.amount-formula-guide strong {
  color: var(--text);
  font-size: 13px;
}

.amount-formula-guide code {
  overflow-wrap: anywhere;
  color: #0057b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.amount-formula-guide span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.amount-formula-editor-label {
  display: grid;
  gap: 8px;
}

.amount-formula-editor-label > span,
.amount-reference-builder label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

#amountFormulaEditor {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px;
  resize: vertical;
}

.amount-reference-builder {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.amount-reference-builder label {
  display: grid;
  gap: 7px;
}

.amount-reference-builder select {
  width: 100%;
}

.amount-formula-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 13px 15px;
  border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 15px;
  color: var(--muted);
  background: rgba(0, 122, 255, 0.055);
}

.amount-formula-preview strong {
  color: var(--text);
  font-size: 20px;
}

.amount-formula-preview.error {
  border-color: rgba(255, 59, 48, 0.22);
  color: #d70015;
  background: rgba(255, 59, 48, 0.055);
}

@media (max-width: 760px) {
  .amount-formula-guide,
  .amount-reference-builder {
    grid-template-columns: 1fr;
  }

  .amount-reference-builder .span-2 {
    grid-column: auto;
  }

  .amount-formula-preview {
    align-items: flex-start;
    flex-direction: column;
  }
}

.amount-formula-audit-list {
  display: grid;
  gap: 8px;
}

.amount-formula-audit-list > div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.amount-formula-audit-list > div:last-child {
  border-bottom: 0;
}

.amount-formula-audit-list span {
  color: var(--muted);
  font-size: 12px;
}

.amount-formula-audit-list code {
  overflow-wrap: anywhere;
  color: #0057b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.amount-formula-audit-list strong {
  color: var(--text);
  font-size: 13px;
}

/* v6.5 · AI cost recognition and searchable references */
.quote-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.quote-ai-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  color: #0057b8;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.quote-ai-inline:hover {
  color: #007aff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.amount-ai-panel {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 5%, rgba(90, 200, 250, 0.17), transparent 34%),
    linear-gradient(145deg, rgba(0, 122, 255, 0.075), rgba(255, 255, 255, 0.86));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.amount-ai-panel[hidden] {
  display: none !important;
}

.amount-ai-heading,
.amount-ai-title,
.amount-ai-title > div {
  display: flex;
  align-items: center;
}

.amount-ai-heading {
  justify-content: space-between;
  gap: 12px;
}

.amount-ai-title {
  min-width: 0;
  gap: 10px;
}

.amount-ai-title > div {
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
}

.amount-ai-title strong {
  color: var(--text);
  font-size: 14px;
}

.amount-ai-title small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.amount-ai-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #0a84ff, #5e5ce6);
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.24);
  font-size: 16px;
}

.local-ai-badge {
  flex: none;
  padding: 5px 9px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 999px;
  color: #0057b8;
  background: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  font-weight: 750;
}

.amount-ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px auto;
  gap: 10px;
  align-items: end;
}

.amount-ai-grid label {
  display: grid;
  gap: 7px;
}

.amount-ai-grid label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.amount-ai-description textarea {
  min-height: 78px;
  resize: vertical;
}

.amount-ai-grid input,
.amount-ai-grid textarea {
  width: 100%;
}

.amount-ai-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.amount-ai-examples::before {
  align-self: center;
  margin-right: 1px;
  color: var(--muted);
  content: "示例";
  font-size: 11px;
}

.amount-ai-examples button {
  padding: 5px 9px;
  border: 1px solid rgba(0, 122, 255, 0.14);
  border-radius: 999px;
  color: #0057b8;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  cursor: pointer;
}

.amount-ai-examples button:hover {
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(0, 122, 255, 0.08);
}

.amount-ai-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 14px;
  align-items: center;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.amount-ai-result strong {
  color: var(--text);
  font-size: 18px;
}

.amount-ai-result code {
  overflow-wrap: anywhere;
  color: #0057b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.amount-ai-result small {
  grid-column: 1 / -1;
  line-height: 1.5;
}

.amount-ai-result.success {
  border-color: rgba(52, 199, 89, 0.22);
  background: rgba(52, 199, 89, 0.065);
}

.amount-ai-result.error {
  border-color: rgba(255, 59, 48, 0.24);
  color: #d70015;
  background: rgba(255, 59, 48, 0.055);
}

.reference-search-control {
  display: grid;
  gap: 6px;
}

.reference-search-input {
  position: relative;
}

.reference-search-input > span {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  transform: translateY(-50%);
  color: #8e8e93;
  font-size: 14px;
  pointer-events: none;
}

.reference-search-input input {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px 7px 31px;
  border: 1px solid rgba(60, 60, 67, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.reference-search-input input:focus {
  border-color: rgba(0, 122, 255, 0.38);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.09);
  outline: none;
}

.reference-search-control > small {
  min-height: 14px;
  color: var(--muted);
  font-size: 10px;
}

.reference-search-control > small.no-results {
  color: #d70015;
}

@media (max-width: 760px) {
  .quote-heading-actions,
  .quote-heading-actions .button {
    width: 100%;
  }

  .quote-heading-actions .button {
    justify-content: center;
  }

  .amount-ai-heading {
    align-items: flex-start;
  }

  .amount-ai-grid {
    grid-template-columns: 1fr;
  }

  .amount-ai-grid .button {
    width: 100%;
  }

  .amount-ai-result {
    grid-template-columns: 1fr;
  }

  .amount-ai-result strong {
    justify-self: start;
  }
}

.quote-formula-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}


/* v6.6 配方类目与基础配方 */
.recipe-category-board {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 0%, rgba(0, 122, 255, 0.09), transparent 34%),
    rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.045);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
}
.recipe-category-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.recipe-category-heading h3 { margin: 3px 0 4px; font-size: 19px; }
.recipe-category-heading p,
.recipe-category-actions span { margin: 0; color: var(--muted); font-size: 12px; }
.recipe-category-actions { display: flex; align-items: center; gap: 10px; }
.recipe-category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.recipe-category-card {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 13px;
  border: 1px solid rgba(60, 60, 67, 0.1);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.recipe-category-card:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 122, 255, 0.24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.07);
}
.recipe-category-card.active {
  border-color: rgba(0, 122, 255, 0.38);
  background: rgba(0, 122, 255, 0.075);
  box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.08), 0 10px 24px rgba(0, 122, 255, 0.1);
}
.recipe-category-icon {
  display: grid;
  min-width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, #0a84ff, #007aff);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.recipe-category-card.dessert .recipe-category-icon { background: linear-gradient(145deg, #ff9f0a, #ff7a00); }
.recipe-category-card.basque .recipe-category-icon { background: linear-gradient(145deg, #34c759, #20a66b); }
.recipe-category-card.cream .recipe-category-icon { color: #6e4c00; background: linear-gradient(145deg, #fff0b3, #ffd760); }
.recipe-category-card.base .recipe-category-icon { background: linear-gradient(145deg, #af52de, #8e44c6); }
.recipe-category-card div { min-width: 0; }
.recipe-category-card strong,
.recipe-category-card small { display: block; }
.recipe-category-card strong { margin-bottom: 4px; font-size: 14px; }
.recipe-category-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recipe-category-card > b {
  display: grid;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
}
.status-badge.recipe-cream { color: #8a6100; background: #fff5cc; }
.status-badge.recipe-base { color: #7d35a5; background: #f4eafa; }
.component-recipe-mode .sellable-only-field,
.component-recipe-mode .sellable-only-section { display: none !important; }
.component-recipe-mode #productSizeField { color: var(--muted); background: rgba(118, 118, 128, 0.055); }
@media (max-width: 1180px) {
  .recipe-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .recipe-category-board { padding: 14px; border-radius: 18px; }
  .recipe-category-heading { align-items: flex-start; flex-direction: column; }
  .recipe-category-actions { width: 100%; justify-content: space-between; }
  .recipe-category-grid { grid-template-columns: 1fr; }
  .recipe-category-card { min-height: 76px; }
}

/* v6.7 · Supabase 单账号云端 */
.cloud-account-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 9px;
  width: calc(100% - 24px);
  margin: 8px 12px 6px;
  padding: 10px 11px;
  border: 1px solid rgba(120, 120, 128, 0.16);
  border-radius: 14px;
  color: var(--text, #1d1d1f);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 24px rgba(31, 35, 41, 0.05);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.cloud-account-button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(255, 255, 255, 0.94);
}

.cloud-account-button[data-cloud-tone="online"] {
  border-color: rgba(52, 199, 89, 0.24);
  background: rgba(240, 253, 244, 0.84);
}

.cloud-account-button[data-cloud-tone="warning"] {
  border-color: rgba(255, 149, 0, 0.3);
  background: rgba(255, 248, 235, 0.9);
}

.cloud-account-button[data-cloud-tone="syncing"] {
  border-color: rgba(0, 122, 255, 0.3);
  background: rgba(239, 247, 255, 0.92);
}

.cloud-account-icon {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
  font-size: 17px;
}

.cloud-status-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #8e8e93;
}

.cloud-status-dot[data-cloud-tone="online"] { background: #34c759; }
.cloud-status-dot[data-cloud-tone="warning"] { background: #ff9500; }
.cloud-status-dot[data-cloud-tone="syncing"] { background: #007aff; animation: cloudPulse 1.2s infinite; }
.cloud-status-dot[data-cloud-tone="offline"] { background: #8e8e93; }

.cloud-account-copy {
  min-width: 0;
}

.cloud-account-copy strong,
.cloud-account-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-account-copy strong {
  font-size: 12px;
  font-weight: 760;
}

.cloud-account-copy small {
  margin-top: 2px;
  color: #8e8e93;
  font-size: 9px;
}

.cloud-account-chevron {
  color: #aeaeb2;
  font-size: 20px;
  line-height: 1;
}

.save-dot[data-cloud-tone="online"] { background: #34c759; }
.save-dot[data-cloud-tone="warning"] { background: #ff9500; }
.save-dot[data-cloud-tone="offline"] { background: #8e8e93; }

.cloud-data-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(0, 122, 255, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 95% 0%, rgba(0, 122, 255, 0.12), transparent 38%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.92));
  box-shadow: 0 14px 36px rgba(0, 55, 120, 0.08);
}

.cloud-data-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.cloud-data-heading h3 {
  margin: 2px 0 3px;
  font-size: 17px;
}

.cloud-data-heading p {
  margin: 0;
  color: #6e6e73;
  font-size: 11px;
}

.cloud-data-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: #636366;
  background: rgba(142, 142, 147, 0.12);
  font-size: 10px;
  font-weight: 750;
}

.cloud-data-badge[data-cloud-tone="online"] { color: #248a3d; background: rgba(52, 199, 89, 0.13); }
.cloud-data-badge[data-cloud-tone="warning"] { color: #b05b00; background: rgba(255, 149, 0, 0.14); }
.cloud-data-badge[data-cloud-tone="syncing"] { color: #0066cc; background: rgba(0, 122, 255, 0.12); }

.cloud-data-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 14px;
  padding: 11px 12px;
  border: 1px solid rgba(120, 120, 128, 0.12);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.cloud-data-status strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.cloud-data-status span {
  grid-column: 1;
  color: #6e6e73;
  font-size: 10px;
}

.cloud-data-status small {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: #8e8e93;
  font-size: 9px;
  text-align: right;
}

.cloud-sync-progress {
  min-height: 14px;
  color: #007aff;
  font-size: 10px;
  font-weight: 650;
}

.cloud-sync-progress:empty { display: none; }

.cloud-data-actions,
.cloud-auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cloud-auth-body {
  display: grid;
  gap: 16px;
}

.cloud-setup-notice,
.cloud-security-note,
.cloud-connected-account {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border-radius: 15px;
}

.cloud-setup-notice {
  border: 1px solid rgba(0, 122, 255, 0.16);
  background: rgba(0, 122, 255, 0.06);
}

.cloud-setup-number,
.cloud-connected-icon {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: #007aff;
  font-size: 12px;
  font-weight: 800;
}

.cloud-setup-notice strong,
.cloud-connected-account strong,
.cloud-security-note strong {
  display: block;
  font-size: 12px;
}

.cloud-setup-notice p,
.cloud-connected-account p {
  margin: 3px 0 0;
  color: #6e6e73;
  font-size: 10px;
  line-height: 1.55;
}

.cloud-setup-notice code {
  padding: 2px 5px;
  border-radius: 5px;
  color: #0066cc;
  background: rgba(0, 122, 255, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

.cloud-form-grid label {
  display: grid;
  gap: 6px;
}

.cloud-form-grid label.span-2 { grid-column: 1 / -1; }

.cloud-form-grid label > span {
  color: #3a3a3c;
  font-size: 11px;
  font-weight: 720;
}

.cloud-form-grid input,
.cloud-form-grid textarea {
  width: 100%;
  border: 1px solid rgba(120, 120, 128, 0.22);
  border-radius: 11px;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
}

.cloud-form-grid input { min-height: 42px; padding: 0 12px; }
.cloud-form-grid textarea { min-height: 72px; padding: 10px 12px; resize: vertical; }

.cloud-form-grid input:focus,
.cloud-form-grid textarea:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.11);
}

.cloud-form-grid label small {
  color: #8e8e93;
  font-size: 9px;
  line-height: 1.45;
}

.cloud-connected-account {
  border: 1px solid rgba(52, 199, 89, 0.2);
  background: rgba(52, 199, 89, 0.08);
}

.cloud-connected-icon { background: #34c759; }

.cloud-security-note {
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #6e6e73;
  background: rgba(118, 118, 128, 0.07);
}

.cloud-security-note span {
  max-width: 72%;
  font-size: 10px;
  line-height: 1.55;
  text-align: right;
}

.cloud-auth-footer {
  align-items: center;
  gap: 12px;
}

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

.cloud-choice-card {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 190px;
  padding: 16px;
  border: 1px solid rgba(120, 120, 128, 0.18);
  border-radius: 17px;
  color: #1d1d1f;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.cloud-choice-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 122, 255, 0.34);
  box-shadow: 0 14px 34px rgba(0, 74, 173, 0.1);
}

.cloud-choice-card.remote { background: linear-gradient(150deg, #fff, #f1f7ff); }
.cloud-choice-card.local { background: linear-gradient(150deg, #fff, #f7f7fa); }

.cloud-choice-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
  font-size: 10px;
  font-weight: 800;
}

.cloud-choice-card strong { font-size: 15px; }
.cloud-choice-card small { min-height: 54px; color: #6e6e73; font-size: 10px; line-height: 1.55; }
.cloud-choice-card b { margin-top: auto; color: #007aff; font-size: 11px; }

.cloud-choice-warning {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 11px;
  color: #9a5200;
  background: rgba(255, 149, 0, 0.1);
  font-size: 10px;
  line-height: 1.55;
}

@keyframes cloudPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.72); opacity: 0.55; }
}

@media (max-width: 720px) {
  .cloud-form-grid,
  .cloud-choice-grid { grid-template-columns: 1fr; }
  .cloud-form-grid label.span-2 { grid-column: auto; }
  .cloud-data-status { grid-template-columns: 1fr; }
  .cloud-data-status small { grid-column: 1; grid-row: auto; text-align: left; }
  .cloud-security-note { align-items: flex-start; flex-direction: column; gap: 6px; }
  .cloud-security-note span { max-width: none; text-align: left; }
  .cloud-auth-footer { align-items: stretch; }
  .cloud-auth-actions { width: 100%; }
  .cloud-auth-actions .button { flex: 1 1 auto; }
  .cloud-data-actions .button { flex: 1 1 calc(50% - 8px); }
}

.cloud-connected-account[hidden],
#cloudAuthFields[hidden],
#cloudSignInBtn[hidden],
#cloudSignUpBtn[hidden],
#cloudDisconnectBtn[hidden] {
  display: none !important;
}
#cloudUseLocalBtn[hidden] { display: none !important; }

/* v6.8 incremental refinements */
.ai-provider-controls {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(180px, 1.4fr) minmax(130px, 0.9fr) auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 12px;
}

.ai-provider-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
}

.ai-provider-controls select,
.ai-provider-controls input[type="text"],
.ai-provider-controls input[type="password"] {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  font-size: 10px;
}

.ai-provider-controls .minimax-remember {
  display: flex;
  align-items: center;
  min-height: 36px;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.ai-provider-controls .minimax-remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.minimax-field[hidden] {
  display: none !important;
}

.procedure-notes-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.procedure-notes-field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 840;
}

.procedure-notes-field textarea,
.formula-table textarea {
  width: 100%;
  min-height: 74px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  color: var(--text);
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
  resize: vertical;
}

.formula-table textarea:focus,
.procedure-notes-field textarea:focus {
  border-color: rgba(155, 70, 104, 0.45);
  box-shadow: 0 0 0 3px rgba(155, 70, 104, 0.10);
}

.other-item-picker {
  display: block;
}

.cost-detail-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.text-recipe-panel {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
}

.text-recipe-section + .text-recipe-section {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
}

.text-recipe-section > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 13px;
}

.text-recipe-section ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: #4d4248;
  font-size: 11px;
  line-height: 1.65;
}

.procedure-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.procedure-note strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 12px;
}

.procedure-note p {
  margin: 0;
  color: #4d4248;
  font-size: 11px;
  line-height: 1.8;
  white-space: normal;
}

.clickable-metric {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.clickable-metric:hover,
.clickable-metric:focus-visible {
  transform: translateY(-1px);
  border-color: #8fbfff;
  box-shadow: 0 12px 26px rgba(47, 111, 237, 0.12);
  outline: none;
}

.category-combo-field {
  gap: 8px;
}

.category-combo-field select,
.category-combo-field input {
  width: 100%;
}

.category-combo-field input[hidden] {
  display: none !important;
}

@media (min-width: 761px) {
  #productsTableContainer {
    overflow: auto !important;
  }

  #productsTableContainer .responsive-product-table {
    display: table !important;
    width: 100% !important;
    min-width: 1480px;
    border-collapse: separate !important;
    border-spacing: 0 10px !important;
    background: transparent !important;
  }

  #productsTableContainer .responsive-product-table thead {
    display: table-header-group !important;
  }

  #productsTableContainer .responsive-product-table tbody {
    display: table-row-group !important;
  }

  #productsTableContainer .responsive-product-table tr {
    display: table-row !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  #productsTableContainer .responsive-product-table th,
  #productsTableContainer .responsive-product-table td {
    display: table-cell !important;
  }

  #productsTableContainer .responsive-product-table td {
    min-height: 0 !important;
    padding: 13px 14px !important;
    border-top: 1px solid #e8edf5 !important;
    border-bottom: 1px solid #e8edf5 !important;
    border-right: 0 !important;
    background: #fff !important;
    vertical-align: middle !important;
  }

  #productsTableContainer .responsive-product-table td::before {
    content: none !important;
    display: none !important;
  }

  #productsTableContainer .responsive-product-table tbody td:first-child {
    border-left: 1px solid #e8edf5 !important;
    border-radius: 14px 0 0 14px !important;
  }

  #productsTableContainer .responsive-product-table tbody td:last-child {
    border-right: 1px solid #e8edf5 !important;
    border-radius: 0 14px 14px 0 !important;
  }

  #productsTableContainer .responsive-product-table td.image-cell,
  #productsTableContainer .responsive-product-table td.primary-cell,
  #productsTableContainer .responsive-product-table td.log-cell,
  #productsTableContainer .responsive-product-table td.actions-cell,
  #productsTableContainer .responsive-product-table td.select-cell {
    grid-column: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    box-shadow: none !important;
  }

  #productsTableContainer .responsive-product-table td.image-cell .record-image-button {
    width: 54px;
    height: 54px;
    margin: 0;
    border-radius: 12px;
  }

  #productsTableContainer .responsive-product-table .latest-log {
    max-width: 250px;
  }

  #productsTableContainer .responsive-product-table .latest-log span {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #productsTableContainer .responsive-product-table .row-actions {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }

  #productsTableContainer .responsive-product-table .row-button {
    width: auto !important;
    min-width: 72px;
    min-height: 32px;
    padding-inline: 10px;
    white-space: nowrap;
  }

  #costsTableContainer .responsive-cost-table {
    min-width: 1560px;
  }
}

@media (max-width: 920px) {
  .ai-provider-controls {
    grid-template-columns: 1fr;
  }
}

/* 2026-06-26 refinement: global amount references, overview readability, product row selection */
.overview-metrics .metric-card {
  min-height: 118px;
  gap: 22px;
  padding: 26px 28px;
}

.overview-metrics .metric-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 20px;
}

.overview-metrics .metric-card div > span {
  font-size: 16px;
}

.overview-metrics .metric-card strong {
  font-size: 42px;
  line-height: 1.05;
}

.overview-metrics .metric-card small {
  margin-top: 7px;
  font-size: 14px;
  white-space: normal;
}

.amount-reference-builder {
  grid-template-columns: minmax(0, 2.4fr) minmax(190px, 0.7fr) auto;
}

.amount-reference-builder .reference-library-field {
  display: none !important;
}

.amount-reference-builder .span-3 {
  grid-column: span 1;
}

.amount-reference-builder select,
.reference-search-input input {
  min-height: 44px;
  font-size: 15px;
}

.reference-search-control > small {
  font-size: 12px;
}

@media (min-width: 761px) {
  #productsTableContainer .responsive-product-table {
    min-width: 1580px !important;
  }

  #productsTableContainer .responsive-product-table td.select-cell,
  #productsTableContainer .responsive-product-table th.select-cell {
    position: static !important;
    width: auto !important;
    min-width: 46px !important;
    min-height: 0 !important;
    padding: 13px 14px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
}

@media (max-width: 760px) {
  .overview-metrics .metric-card {
    min-height: 0;
    gap: 14px;
    padding: 18px;
  }

  .overview-metrics .metric-icon {
    width: 48px;
    height: 48px;
    font-size: 15px;
  }

  .overview-metrics .metric-card div > span {
    font-size: 13px;
  }

  .overview-metrics .metric-card strong {
    font-size: 28px;
  }

  .overview-metrics .metric-card small {
    font-size: 12px;
  }

  .amount-reference-builder {
    grid-template-columns: 1fr;
  }
}

/* 2026-06-26 refinement: product table fit and calmer visual rhythm */
.ai-import-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (min-width: 761px) {
  #productsTableContainer {
    overflow-x: hidden !important;
  }

  #productsTableContainer .table-sort-note {
    padding: 14px 22px;
    border: 1px solid #edf1f6;
    border-radius: 14px;
    background: #fbfcff;
  }

  #productsTableContainer .responsive-product-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed !important;
    border-spacing: 0 8px !important;
  }

  #productsTableContainer .responsive-product-table col.col-select { width: 2.2%; }
  #productsTableContainer .responsive-product-table col.col-image { width: 3.8%; }
  #productsTableContainer .responsive-product-table col.col-product { width: 12%; }
  #productsTableContainer .responsive-product-table col.col-size { width: 3.6%; }
  #productsTableContainer .responsive-product-table col.col-type { width: 5.4%; }
  #productsTableContainer .responsive-product-table col.col-formula { width: 4.2%; }
  #productsTableContainer .responsive-product-table col.col-material { width: 6.2%; }
  #productsTableContainer .responsive-product-table col.col-markup { width: 6.4%; }
  #productsTableContainer .responsive-product-table col.col-packaging { width: 5.6%; }
  #productsTableContainer .responsive-product-table col.col-total { width: 6.2%; }
  #productsTableContainer .responsive-product-table col.col-suggested { width: 5.8%; }
  #productsTableContainer .responsive-product-table col.col-average { width: 6.2%; }
  #productsTableContainer .responsive-product-table col.col-actual { width: 4.6%; }
  #productsTableContainer .responsive-product-table col.col-status { width: 5%; }
  #productsTableContainer .responsive-product-table col.col-log { width: 6.4%; }
  #productsTableContainer .responsive-product-table col.col-updated { width: 5%; }
  #productsTableContainer .responsive-product-table col.col-actions { width: 11.4%; }

  #productsTableContainer .responsive-product-table th {
    padding: 12px 8px !important;
    color: #687182;
    background: #f6f8fb;
    font-size: 11px;
    font-weight: 800;
    white-space: normal;
  }

  #productsTableContainer .product-table th:last-child,
  #productsTableContainer .product-table td:last-child {
    position: static !important;
    right: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
  }

  #productsTableContainer .responsive-product-table td {
    padding: 12px 8px !important;
    color: #1f2329;
    font-size: 12px;
    line-height: 1.38;
    word-break: break-word;
  }

  #productsTableContainer .responsive-product-table tbody tr {
    transition: box-shadow 0.16s ease, transform 0.16s ease;
  }

  #productsTableContainer .responsive-product-table tbody tr:hover td {
    background: #fbfdff !important;
  }

  #productsTableContainer .responsive-product-table td.image-cell .record-image-button {
    width: 46px !important;
    height: 46px !important;
    border-radius: 12px !important;
  }

  #productsTableContainer .responsive-product-table .primary-cell strong {
    font-size: 13px;
    line-height: 1.35;
  }

  #productsTableContainer .responsive-product-table .size-chip {
    min-width: 0;
    padding: 5px 8px;
    font-size: 11px;
    line-height: 1.2;
  }

  #productsTableContainer .responsive-product-table .price-main,
  #productsTableContainer .responsive-product-table td.number strong {
    font-size: 13px;
  }

  #productsTableContainer .responsive-product-table .price-sub {
    margin-top: 3px;
    font-size: 10px;
    white-space: normal;
  }

  #productsTableContainer .responsive-product-table .latest-log {
    max-width: none;
    gap: 2px;
  }

  #productsTableContainer .responsive-product-table .latest-log span {
    max-width: 100%;
    white-space: normal;
  }

  #productsTableContainer .responsive-product-table .row-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  #productsTableContainer .responsive-product-table .row-button {
    min-width: 0 !important;
    min-height: 30px;
    padding: 6px 4px;
    font-size: 11px;
    line-height: 1.18;
    white-space: normal;
  }
}

@media (max-width: 760px) {
  .ai-import-actions,
  .ai-import-actions .button {
    width: 100%;
  }

  .ai-import-actions .button {
    justify-content: center;
  }
}

/* 2026-06-27 Admin Center skin: cleaner UI and lighter rendering */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-soft: #fbfbfd;
  --surface-3: #f1f2f6;
  --sidebar: #ffffff;
  --sidebar-soft: #f6f7fb;
  --text: #1d1d1f;
  --muted: #86868b;
  --muted-2: #a0a0a6;
  --line: rgba(16, 24, 40, 0.10);
  --line-strong: rgba(16, 24, 40, 0.16);
  --accent: #0071e3;
  --accent-strong: #005ecb;
  --accent-soft: rgba(0, 113, 227, 0.10);
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.10);
  --green: #1e9f64;
  --green-soft: rgba(30, 159, 100, 0.12);
  --amber: #e67e22;
  --amber-soft: rgba(230, 126, 34, 0.12);
  --red: #d92d20;
  --red-soft: rgba(217, 45, 32, 0.10);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 28px 80px rgba(16, 24, 40, 0.16), 0 8px 24px rgba(16, 24, 40, 0.08);
  --radius: 18px;
  --radius-sm: 11px;
  --ease: cubic-bezier(0.22, 0.8, 0.22, 1);
}

html,
body {
  background:
    radial-gradient(900px 560px at 84% -14%, rgba(94, 92, 230, 0.08), transparent 65%),
    radial-gradient(820px 500px at 8% 0%, rgba(0, 113, 227, 0.07), transparent 64%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  text-rendering: optimizeLegibility;
}

body {
  -moz-osx-font-smoothing: grayscale;
}

* {
  scrollbar-color: rgba(134, 134, 139, 0.35) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(134, 134, 139, 0.34);
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  width: 248px;
  padding: 18px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.brand-block {
  min-height: 48px;
  gap: 12px;
  padding: 4px 6px 18px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 13px;
  color: #1d1d1f;
  background:
    linear-gradient(145deg, #ffe9c2, #ffffff 48%, #f6c66a),
    #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 8px 22px rgba(182, 112, 22, 0.16);
  font-size: 13px;
  letter-spacing: 0;
}

.brand-copy strong {
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
}

.brand-copy span,
.sidebar-footer small {
  color: var(--muted);
}

.nav-label {
  margin: 12px 10px 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.nav-item,
.sidebar-tool {
  min-height: 44px;
  gap: 9px;
  padding: 0 10px;
  border-radius: 10px;
  color: #515154;
  font-size: 14px;
  font-weight: 760;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.nav-item svg,
.sidebar-tool svg {
  width: 18px;
  height: 18px;
  padding: 6px;
  box-sizing: content-box;
  border-radius: 8px;
  color: #515154;
  background: #f0f3f7;
  fill: currentColor;
}

.nav-item:hover,
.sidebar-tool:hover,
.nav-item.active {
  color: var(--blue);
  border-color: #cfe0fb;
  background: var(--blue-soft);
  box-shadow: none;
}

.nav-item:hover svg,
.sidebar-tool:hover svg,
.nav-item.active svg {
  color: var(--blue);
  background: #dcecff;
}

.nav-item.active {
  background: var(--blue-soft);
  box-shadow: none;
}

.nav-count {
  color: var(--muted);
  background: rgba(16, 24, 40, 0.06);
}

.nav-item.active .nav-count {
  color: var(--blue);
  background: rgba(0, 113, 227, 0.12);
}

.nav-sublist {
  display: grid;
  gap: 4px;
  margin: -2px 0 6px 43px;
}

.nav-subitem {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: #6b7280;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 720;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.nav-subitem:hover,
.nav-subitem.active {
  color: var(--blue);
  background: rgba(0, 113, 227, 0.08);
}

.nav-sub-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  color: #8b95a5;
  background: rgba(16, 24, 40, 0.05);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.nav-subitem.active .nav-sub-count {
  color: var(--blue);
  background: rgba(0, 113, 227, 0.12);
}

.product-category-field[hidden] {
  display: none !important;
}

.cloud-account-button {
  border-color: var(--line);
  border-radius: 12px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.sidebar-footer {
  padding: 14px 6px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.workspace {
  background: transparent;
}

.topbar {
  min-height: 92px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 247, 0.88);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
}

.eyebrow,
.section-kicker,
.hero-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.topbar h1 {
  margin-top: 4px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.18;
  letter-spacing: 0;
}

.page-description {
  color: var(--muted);
  font-size: 14px;
}

.content {
  padding: 20px 24px 36px;
}

.button,
.row-button,
.link-button,
.icon-button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

.button,
.row-button,
.icon-button {
  border-radius: 11px;
  transition: transform 150ms var(--ease), background 150ms var(--ease), border-color 150ms var(--ease), box-shadow 150ms var(--ease), color 150ms var(--ease);
}

.button.primary,
.row-button.primary-action {
  border-color: rgba(0, 83, 174, 0.45);
  color: #fff;
  background: linear-gradient(180deg, #1681ed, #0067d3);
  box-shadow: 0 7px 18px rgba(0, 113, 227, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.button.primary:hover,
.row-button.primary-action:hover {
  background: linear-gradient(180deg, #2390ff, #006bd8);
  box-shadow: 0 9px 24px rgba(0, 113, 227, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.button.secondary,
.button.ghost,
.row-button,
.icon-button {
  border-color: var(--line);
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.button.secondary:hover,
.button.ghost:hover,
.row-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  box-shadow: var(--shadow-md);
}

.button.text,
.link-button {
  color: var(--blue);
  background: transparent;
}

.hero-panel {
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.33fr);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
}

.hero-panel::after {
  display: none;
}

.hero-panel h2 {
  max-width: 780px;
  color: var(--text);
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: 0;
}

.hero-panel p {
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
}

.button.light {
  color: #fff;
  background: linear-gradient(180deg, #1681ed, #0067d3);
  border-color: rgba(0, 83, 174, 0.45);
  box-shadow: 0 7px 18px rgba(0, 113, 227, 0.20);
}

.button.text-light {
  color: var(--blue);
}

.health-card {
  color: var(--text);
  background: var(--panel-soft);
  border-color: var(--line);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.health-ring {
  background: conic-gradient(var(--blue) var(--health), rgba(0, 113, 227, 0.12) 0);
}

.health-ring::after {
  background: #fff;
}

.metric-card,
.mini-metric,
.panel,
.recipe-category-board,
.feature-check-strip,
.library-intro,
.cost-detail-panel,
.data-summary-item,
.data-action-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  contain: layout paint;
}

.metric-card,
.mini-metric {
  min-height: 104px;
  padding: 16px;
}

.metric-card:hover,
.mini-metric:hover,
.overview-jump-card:hover,
.clickable-metric:hover,
.recipe-category-card:hover,
.data-action-card:hover {
  transform: translateY(-1px);
  border-color: #cfe0fb;
  box-shadow: var(--shadow-md);
}

.metric-card strong,
.mini-metric strong {
  color: var(--text);
  font-size: 25px;
}

.metric-icon {
  border-radius: 12px;
}

.panel {
  padding: 16px;
}

.panel-heading h3,
.settings-panel h3,
.library-intro h2,
.recipe-category-heading h3 {
  color: var(--text);
  letter-spacing: 0;
}

.data-flow,
.pricing-mode-display,
.feature-check-strip {
  background: var(--panel-soft);
}

.flow-node {
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.flow-node.result {
  background: var(--blue-soft);
  border-color: #cfe0fb;
}

.recipe-category-board {
  padding: 16px;
}

.recipe-category-card {
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: none;
}

.recipe-category-card.active {
  border-color: #b8d8fb;
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.recipe-category-icon {
  border-radius: 10px;
  background: #f0f3f7;
}

.recipe-category-card.basque .recipe-category-icon {
  color: #0f6b43;
  background: #e4f7ec;
}

.table-panel {
  overflow: hidden;
}

.table-toolbar {
  min-height: auto;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.advanced-toolbar {
  align-items: start;
}

.filter-stack {
  flex: 1 1 680px;
  min-width: 0;
}

.filter-row {
  gap: 10px;
}

.product-library-panel .filter-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(150px, 0.65fr) minmax(130px, 0.55fr);
}

.costsView .filter-row,
#costsView .filter-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) repeat(5, minmax(116px, 0.5fr));
}

.search-box {
  min-width: 0;
  border-color: var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.search-box input,
.select-control,
.form-grid input,
.form-grid select,
.form-grid textarea,
.settings-grid input,
.settings-grid select,
.formula-table input,
.formula-table select,
.quote-table input,
.quote-table select,
.quote-table textarea {
  min-height: 44px;
  border-color: var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel-soft);
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), background 150ms var(--ease);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.range-filter-row {
  gap: 10px;
  margin-top: 10px;
}

.price-range-filter {
  border-color: var(--line);
  background: var(--panel-soft);
}

.selection-summary,
.basis-chip,
.pill,
.status-badge,
.size-chip,
.price-chip {
  border-radius: 999px;
}

.selection-summary {
  color: #7c3d59;
  background: #fff8fb;
  border-color: #f1d7e4;
}

.table-sort-note {
  color: var(--muted);
  background: var(--panel-soft);
  border-color: var(--line);
}

.table-container,
#productsTableContainer,
#costsTableContainer,
#materialsTableContainer,
#suppliesTableContainer {
  contain: layout paint;
}

.data-table {
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  font-size: 13px;
}

.data-table th {
  padding: 12px 12px;
  color: var(--muted);
  background: #f6f7fb;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: #303033;
  font-size: 13px;
  line-height: 1.45;
}

.data-table tbody tr {
  transition: background 120ms ease;
}

.data-table tbody tr:hover td {
  background: #fafcff;
}

.data-table tbody tr.selected-row td {
  background: rgba(0, 113, 227, 0.06);
}

.primary-cell strong {
  color: var(--text);
}

.primary-cell span,
.primary-cell small,
.price-sub,
.latest-log span,
.updated-cell {
  color: var(--muted);
}

.record-image-button,
.image-upload-surface,
.editor-image-card {
  border-color: var(--line);
  background: linear-gradient(180deg, #ffffff, #f8f9fc);
  box-shadow: var(--shadow-sm);
}

.row-actions {
  gap: 6px;
}

.row-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.status-badge.complete {
  color: var(--green);
  background: var(--green-soft);
}

.status-badge.warning,
.status-badge.missing {
  color: #b55300;
  background: var(--amber-soft);
}

.status-badge.archived {
  color: #515154;
  background: #f1f2f6;
}

.settings-panel,
.form-section,
.formula-workbench,
.quote-section {
  border-color: var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.settings-panel summary,
.settings-apply-bar,
.formula-preview {
  background: var(--panel-soft);
}

.modal-backdrop {
  background: rgba(29, 29, 31, 0.32);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.modal {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lg);
  animation: modalIn 160ms var(--ease);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.modal-body {
  background: #fff;
}

.modal-header h2 {
  color: var(--text);
  letter-spacing: 0;
}

.product-editor-rail {
  border-color: var(--line);
  background: var(--panel-soft);
}

.editor-step-nav button {
  border-color: var(--line);
  background: #fff;
}

.editor-step-nav button:hover,
.editor-step-nav button.active {
  border-color: #cfe0fb;
  color: var(--blue);
  background: var(--blue-soft);
}

.formula-table-wrap,
.quote-editor {
  border-color: var(--line);
  background: #fff;
}

.formula-table th,
.quote-table th {
  background: #f6f7fb;
  color: var(--muted);
}

.formula-section-row td {
  border-color: var(--line) !important;
  background: #f7f9fc;
  color: var(--blue);
}

.formula-preview {
  border-color: var(--line);
}

.cost-card-hero {
  color: var(--text);
  border: 1px solid var(--line);
  background:
    radial-gradient(700px 260px at 86% 10%, rgba(0, 113, 227, 0.12), transparent 62%),
    #fff;
  box-shadow: var(--shadow-sm);
}

.cost-card-overline,
.cost-card-hero p {
  color: var(--muted);
}

.cost-card-hero h3 {
  color: var(--text);
}

.cost-card-hero-actions > span {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(30, 159, 100, 0.16);
}

.cost-card-metric,
.cost-detail-panel {
  border-color: var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.cost-card-metric.accent {
  border-color: #cfe0fb;
  background: var(--blue-soft);
}

.cost-card-metric.accent strong {
  color: var(--blue);
}

.toast {
  border-radius: 14px;
  background: rgba(29, 29, 31, 0.92);
  box-shadow: 0 16px 42px rgba(16, 24, 40, 0.22);
}

.view {
  animation: surfaceIn 160ms var(--ease);
}

@keyframes surfaceIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 761px) {
  #productsTableContainer .responsive-product-table th {
    background: #f6f7fb !important;
    color: var(--muted) !important;
  }

  #productsTableContainer .responsive-product-table td {
    color: #303033 !important;
    font-size: 12.5px !important;
  }

  #productsTableContainer .responsive-product-table tbody tr:hover td {
    background: #fafcff !important;
  }
}

.birthday-fold-row > td {
  border-top: 1px solid #dbeafe !important;
  border-bottom-color: #dbeafe !important;
  background: #f7fbff !important;
}

.birthday-fold-row:hover > td,
.birthday-fold-row.expanded > td {
  background: #eef6ff !important;
}

.birthday-fold-row.selected-row > td {
  background: #f0f7ff !important;
}

.birthday-fold-image-button {
  width: 56px;
  height: 56px;
}

.birthday-fold-image-button .record-image-placeholder {
  font-size: 18px;
  font-weight: 880;
}

.birthday-fold-summary-cell {
  padding: 13px 16px !important;
}

.birthday-fold-card {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(460px, 1.8fr) minmax(150px, auto);
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.birthday-fold-title-block {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.birthday-fold-title-block > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.birthday-fold-toggle {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.birthday-fold-toggle strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.birthday-fold-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(126px, 1fr));
  gap: 8px;
  min-width: 0;
}

.birthday-fold-metric {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #dceafe;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.birthday-fold-metric small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  line-height: 1.2;
}

.birthday-fold-metric b {
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.birthday-fold-side {
  display: grid;
  justify-items: end;
  gap: 7px;
  min-width: 0;
}

.birthday-fold-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.birthday-fold-side small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.fold-chevron {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(0, 113, 227, 0.10);
  font-size: 16px;
  line-height: 1;
  transition: transform 150ms ease;
}

.birthday-fold-row.expanded .fold-chevron {
  transform: rotate(90deg);
}

.birthday-size-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.birthday-fold-child > td {
  background: #fff !important;
  border-bottom-color: #edf4ff !important;
}

.birthday-fold-child > td.primary-cell {
  padding-left: 22px !important;
}

.birthday-fold-child > td.primary-cell strong::before {
  content: "↳ ";
  color: var(--muted);
  font-weight: 700;
}

.product-library-panel,
.library-floating-panel,
.cost-library-panel {
  overflow: visible;
}

.product-library-panel > .advanced-toolbar,
.library-floating-panel > .table-toolbar,
.cost-library-panel > .advanced-toolbar {
  position: sticky;
  top: var(--product-sticky-top, var(--ui-topbar-height, 76px));
  z-index: 24;
  margin: -1px -1px 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.product-compare-modal {
  width: min(96vw, 1380px);
}

.product-compare-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.product-compare-summary > div {
  display: grid;
  gap: 6px;
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(25, 72, 139, 0.06);
}

.product-compare-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-compare-summary strong {
  color: var(--ink);
  font-size: 19px;
}

.product-compare-scroll {
  max-height: min(62vh, 680px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

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

.product-compare-table th,
.product-compare-table td {
  min-width: 180px;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: #2f3542;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  vertical-align: top;
}

.product-compare-table tr > th[scope="row"],
.product-compare-table .compare-head th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  background: #f8fbff;
  color: #5f6b7d;
  font-weight: 900;
}

.product-compare-table .compare-head th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f2f7ff;
  color: #111827;
  font-weight: 900;
}

.product-compare-table .compare-head th:first-child {
  z-index: 4;
}

.product-compare-table .compare-head strong,
.product-compare-table .compare-head span {
  display: block;
}

.product-compare-table .compare-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.product-compare-table td.strong {
  color: #111827;
  font-weight: 900;
}

.product-compare-table td.total {
  background: #eef6ff;
  color: var(--blue);
  font-size: 16px;
}

@media (max-width: 1320px) {
  .birthday-fold-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .birthday-fold-side {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
}

@media (max-width: 900px) {
  .birthday-fold-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .product-compare-summary {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 248px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 78px;
    padding: 14px 16px;
  }

  .product-library-panel > .advanced-toolbar,
  .library-floating-panel > .table-toolbar,
  .cost-library-panel > .advanced-toolbar {
    top: var(--product-sticky-top, var(--ui-topbar-height, 68px));
    max-height: calc(100dvh - 108px);
    overflow: auto;
    border-radius: 18px;
  }

  .cost-library-panel > .advanced-toolbar {
    max-height: min(56dvh, 440px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .cost-library-panel .filter-row > .search-box {
    position: sticky;
    top: 0;
    z-index: 2;
    grid-column: 1 / -1;
    background: #fff;
  }

  .content {
    padding: 16px 12px 34px;
  }

  .hero-panel {
    padding: 20px;
  }

  .hero-panel h2 {
    font-size: 28px;
  }

  .product-library-panel .filter-row,
  .library-floating-panel .filter-row,
  #costsView .filter-row {
    grid-template-columns: 1fr;
  }

  .modal {
    border-radius: 20px 20px 0 0;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  #costsView .cost-library-panel .filter-row {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #costsView .cost-library-panel .filter-row > .search-box {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  #costsView .cost-library-panel .filter-row > .select-control {
    width: 100%;
    min-width: 0;
  }
}

.product-library-panel,
.cost-library-panel {
  /* The toolbar starts 15px inside the panel (16px padding minus its -1px margin). */
  scroll-margin-top: max(0px, calc(var(--product-sticky-top, var(--ui-topbar-height, 76px)) - 15px));
}

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

/* 2026-07-04 dashboard readability polish */
.metric-card .metric-icon,
.overview-metrics .metric-card .metric-icon {
  display: inline-grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  text-align: center;
}

.overview-metrics .metric-card .metric-icon {
  font-size: 20px;
}

.flow-node.result {
  border-color: #bad8ff;
  color: #101828;
  background: linear-gradient(135deg, #f8fbff 0%, #e6f1ff 100%);
}

.flow-node.result .flow-index {
  color: #0875e1;
}

.flow-node.result strong {
  color: #101828;
}

.flow-node.result small {
  color: #667085;
}

/* 2026-07-04 supply offer maintenance */
.library-intro.supply-offers-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 122px;
  padding: 30px 34px;
  margin-bottom: 20px;
}

.supply-offers-intro h2 {
  margin: 8px 0 9px;
  font-size: 29px;
  line-height: 1.15;
}

.supply-offers-intro p {
  max-width: 760px;
  font-size: 13px;
  line-height: 1.7;
}

.supply-offers-intro .section-kicker {
  display: block;
  letter-spacing: 0.16em;
}

.supply-offers-intro .legend-row {
  align-self: end;
  padding: 0 4px 4px 0;
  font-size: 12px;
}

.supply-offer-category-jumps {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

#supplyOffersView .supply-offer-sticky-stack {
  position: sticky;
  top: 124px;
  z-index: 24;
  display: grid;
  gap: 14px;
  margin: 18px 0 16px;
  padding: 10px 0 14px;
  background: linear-gradient(180deg, #f3f5f9 0%, #f3f5f9 78%, rgba(243, 245, 249, 0));
}

#supplyOffersView .supply-offer-sticky-stack .supply-offer-category-jumps {
  margin: 0;
}

#supplyOffersView .supply-offer-toolbar-card {
  padding: 12px 14px;
  border: 1px solid #dce7f6;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

#supplyOffersView .supply-offer-toolbar-card .table-toolbar {
  min-height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#supplyOffersView .supply-offer-toolbar-card .filter-row {
  flex: 1 1 360px;
}

#supplyOffersView .supply-offer-toolbar-card .search-box {
  width: min(420px, 100%);
}

#supplyOffersView .supply-offer-results-panel,
#supplyOffersView .supply-offer-results-panel .table-container {
  overflow: visible;
}

#supplyOffersView .table-sort-note {
  position: sticky;
  top: var(--supply-offer-note-top, 306px);
  z-index: 23;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

#supplyOffersView .supply-offer-table thead th {
  top: var(--supply-offer-head-top, 346px);
  z-index: 22;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.supply-offer-category-jump {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-weight: 800;
  text-align: left;
}

.supply-offer-category-jump strong {
  display: inline-flex;
  min-width: 34px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
}

.supply-offer-category-jump.active {
  border-color: #9dccff;
  background: linear-gradient(135deg, #f7fbff 0%, #eaf4ff 100%);
  box-shadow: inset 3px 0 0 var(--blue), var(--shadow-sm);
}

.supply-offer-table .inline-money-edit {
  display: inline-flex;
  width: min(150px, 100%);
  min-height: 38px;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
}

.supply-offer-table .inline-money-edit b {
  color: var(--muted);
  font-size: 13px;
}

.supply-offer-table .inline-money-edit input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: right;
}

.supply-offer-table .inline-money-edit input.field-invalid {
  color: var(--red);
}

.input-prefix input.field-invalid {
  color: var(--red);
}

.supply-offer-table .primary-cell {
  min-width: 220px;
}

.supply-offer-master-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 5px 0 2px;
}

.supply-offer-master-state code {
  padding: 3px 7px;
  color: #42526a;
  background: #f2f5f8;
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.supply-offer-table .actions-cell {
  width: 260px;
  min-width: 260px;
}

.supply-offer-table .actions-cell .row-actions {
  flex-wrap: wrap;
}

.supply-offer-price-cell {
  min-width: 118px;
}

.supply-offer-price-cell strong {
  display: block;
  line-height: 1.2;
}

.library-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.library-table .col-select {
  width: 44px;
}

.library-table .col-image {
  width: 86px;
}

.library-table .col-category {
  width: 94px;
}

.library-table .col-unit {
  width: 72px;
}

.library-table .col-supplier {
  width: 112px;
}

.library-table .col-price-overview {
  width: 245px;
}

.library-table .col-updated {
  width: 128px;
}

.library-table .col-actions {
  width: 238px;
}

.library-table th,
.library-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-table .primary-cell {
  min-width: 0;
}

.library-table .category-cell,
.library-table .unit-cell,
.library-table .supplier-cell {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.library-table .price-overview-cell {
  text-align: left;
}

.price-overview {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.price-overview-main {
  display: block;
  min-width: 0;
  color: var(--text);
  font-weight: 900;
}

.price-overview > small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
}

.library-table .actions-cell {
  white-space: normal;
}

.library-table .actions-cell .row-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.supply-offer-price-cell .formula-result-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.supply-offer-price-cell .formula-result-note.error {
  color: var(--red);
  white-space: normal;
}

.supply-offer-subsection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 0;
  padding: 14px 16px;
  border: 1px solid #d7e8ff;
  border-radius: 14px;
  background: #f7fbff;
  color: var(--muted);
}

.supply-offer-subsection strong {
  color: var(--text);
  font-size: 15px;
}

.supply-offer-subsection span {
  font-size: 12px;
  line-height: 1.6;
}

.supply-offer-image-editor {
  margin-bottom: 18px;
}

.supply-offer-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 0;
}

.supply-offer-policy-grid > label {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #e1e7ef;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.supply-offer-policy-grid > label:has(input:checked) {
  border-color: rgba(0, 113, 227, 0.34);
  background: #f6faff;
  box-shadow: 0 8px 22px rgba(0, 84, 170, 0.07);
}

.supply-offer-policy-grid input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--blue);
  flex: 0 0 auto;
}

.supply-offer-policy-grid label > span,
.supply-offer-policy-grid strong,
.supply-offer-policy-grid small {
  display: block;
  min-width: 0;
}

.supply-offer-policy-grid strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}

.supply-offer-policy-grid small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .supply-offer-policy-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sidebar-tool[href] {
  text-decoration: none;
}

.cloud-hydrating .workspace {
  opacity: 0.72;
  cursor: progress;
  transition: opacity 160ms ease;
}

.cloud-hydrating .workspace::after {
  content: "正在补齐云端配方与明细，编辑暂时锁定…";
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  transform: translateX(-50%);
  padding: 10px 16px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.product-readonly #pagePrimaryBtn,
.product-readonly [data-action^="new-"],
.product-readonly [data-action^="edit-"],
.product-readonly [data-action^="delete-"],
.product-readonly [data-action^="archive-"],
.product-readonly [data-action^="restore-"],
.product-readonly [data-action^="duplicate-"],
.product-readonly [data-action^="import-"],
.product-readonly [data-action^="publish-"],
.product-readonly [data-action^="rename-"],
.product-readonly [data-action^="upload-"],
.product-readonly [data-action="open-demo"] {
  display: none !important;
}

@media (max-width: 1120px) {
  #supplyOffersView .supply-offer-sticky-stack {
    top: 118px;
  }

  .supply-offer-category-jumps {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
}

@media (max-width: 700px) {
  #supplyOffersView .supply-offer-sticky-stack {
    top: 92px;
    gap: 10px;
    margin: 14px 0 12px;
    padding: 8px 0 12px;
  }

  #supplyOffersView .supply-offer-toolbar-card {
    padding: 10px;
    border-radius: 18px;
  }

  #supplyOffersView .supply-offer-toolbar-card .table-toolbar {
    gap: 10px;
  }

  #supplyOffersView .supply-offer-toolbar-card .filter-row,
  #supplyOffersView .supply-offer-toolbar-card .search-box {
    width: 100%;
    flex-basis: 100%;
  }

  #supplyOffersView .supply-offer-toolbar-card .toolbar-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .library-intro.supply-offers-intro {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 24px;
  }

  .supply-offers-intro .legend-row {
    align-self: start;
    padding: 0;
  }

  .supply-offer-category-jumps {
    grid-template-columns: 1fr 1fr;
  }
}

/* 2026-07-11 performance feedback: cancellable view rendering and pagination */
.view-render-pending {
  position: relative;
  min-height: clamp(320px, 58vh, 680px);
  isolation: isolate;
  cursor: progress;
}

.view-render-pending::before {
  position: absolute;
  inset: 0;
  z-index: 50;
  border: 1px solid rgba(16, 24, 40, 0.06);
  border-radius: var(--radius);
  background: rgba(245, 245, 247, 0.84);
  content: "";
  pointer-events: auto;
}

.view-render-pending > :not(.view-skeleton) {
  pointer-events: none;
  user-select: none;
}

.view-skeleton {
  position: relative;
  z-index: 51;
  display: grid;
  width: 100%;
  gap: 10px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
  contain: layout paint;
}

.view-skeleton::after {
  position: absolute;
  inset: 0 auto 0 -55%;
  width: 48%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.74) 48%,
    rgba(255, 255, 255, 0)
  );
  content: "";
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  animation: viewSkeletonSweep 1.35s var(--ease) infinite;
  will-change: transform;
}

.view-skeleton-row {
  --skeleton-primary: 31%;
  position: relative;
  min-height: 56px;
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, 0.06);
  border-radius: 12px;
  background:
    linear-gradient(#e9edf3, #e9edf3) 16px 50% / 32px 32px no-repeat,
    linear-gradient(#e7ebf1, #e7ebf1) 62px calc(50% - 7px) / var(--skeleton-primary) 9px no-repeat,
    linear-gradient(#f0f2f6, #f0f2f6) 62px calc(50% + 9px) / 21% 7px no-repeat,
    linear-gradient(#eceff4, #eceff4) calc(100% - 106px) 50% / 88px 9px no-repeat,
    #fbfbfd;
}

.view-skeleton-row:nth-child(3n + 2) {
  --skeleton-primary: 24%;
}

.view-skeleton-row:nth-child(3n) {
  --skeleton-primary: 37%;
}

@keyframes viewSkeletonSweep {
  to {
    transform: translate3d(325%, 0, 0);
  }
}

.table-pagination {
  position: sticky;
  left: 0;
  z-index: 5;
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -1px 0 rgba(16, 24, 40, 0.02);
  contain: layout paint;
}

.pagination-summary {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination-summary strong {
  color: var(--text);
  font-weight: 800;
}

.pagination-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.pagination-button,
.pagination-size {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #515154;
  background-color: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
  transition: border-color 140ms var(--ease), background 140ms var(--ease), color 140ms var(--ease), box-shadow 140ms var(--ease);
}

.pagination-button {
  display: inline-grid;
  min-width: 36px;
  padding: 0 10px;
  flex: 0 0 auto;
  place-items: center;
}

.pagination-size {
  min-width: 86px;
  margin-left: 4px;
  padding: 0 30px 0 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pagination-button:hover:not(:disabled),
.pagination-size:hover:not(:disabled) {
  color: var(--blue);
  border-color: rgba(0, 113, 227, 0.28);
  background-color: var(--blue-soft);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.08);
}

.pagination-button:focus-visible,
.pagination-size:focus-visible {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.pagination-button.active,
.pagination-button[aria-current="page"] {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.18);
}

.pagination-button:disabled,
.pagination-size:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

@media (max-width: 760px) {
  .view-render-pending {
    min-height: max(360px, 62vh);
  }

  .view-render-pending::before,
  .view-skeleton {
    border-radius: 15px;
  }

  .view-skeleton {
    gap: 9px;
    padding: 12px;
  }

  .view-skeleton-row {
    min-height: 82px;
    background:
      linear-gradient(#e9edf3, #e9edf3) 14px 14px / 42px 42px no-repeat,
      linear-gradient(#e7ebf1, #e7ebf1) 68px 20px / min(44%, 190px) 9px no-repeat,
      linear-gradient(#f0f2f6, #f0f2f6) 68px 38px / min(29%, 126px) 7px no-repeat,
      linear-gradient(#eceff4, #eceff4) 14px calc(100% - 13px) / calc(100% - 28px) 7px no-repeat,
      #fbfbfd;
  }

  .table-pagination {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 11px 12px 12px;
  }

  .pagination-summary {
    width: 100%;
    white-space: normal;
  }

  .pagination-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow: visible;
    padding: 2px 1px 4px;
  }

  .pagination-button,
  .pagination-size {
    min-height: 38px;
  }

  .pagination-size {
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .view-skeleton-row {
    min-height: 76px;
  }

  .pagination-button {
    min-width: 38px;
    padding-inline: 9px;
  }

  .pagination-size {
    min-width: 82px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .view-skeleton::after {
    animation: none;
    opacity: 0.24;
    transform: translate3d(155%, 0, 0);
    will-change: auto;
  }

  .pagination-button,
  .pagination-size {
    transition: none;
  }
}

/* 2026-07-14 responsive library pass -----------------------------------
 * Keep every filter and record action reachable on narrow screens. Each
 * library exposes a compact sticky disclosure; expanding it reveals the
 * complete filter/action surface in a bounded vertical scroller.
 */
.cost-record-list {
  display: grid;
  min-width: 0;
  gap: 12px;
}

body[data-admin-surface="product"] #costsView #costsTableContainer {
  overflow-x: clip !important;
}

.mobile-filter-toggle {
  display: none !important;
}

.cost-record-card {
  display: grid;
  grid-template-areas: "select summary financials actions";
  grid-template-columns:
    44px
    minmax(220px, 1.05fr)
    minmax(430px, 2.7fr)
    minmax(150px, 0.72fr);
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.cost-record-card.selected-row {
  border-color: rgba(0, 113, 227, 0.42);
  background: linear-gradient(90deg, rgba(0, 113, 227, 0.075), #fff 34%);
  box-shadow: inset 3px 0 0 var(--blue), 0 4px 14px rgba(0, 113, 227, 0.09);
}

.cost-record-select {
  grid-area: select;
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  align-self: center;
}

.cost-record-select input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
}

.cost-record-identity {
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.cost-record-identity > * {
  min-width: 0;
}

.cost-record-identity .record-image-button {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  margin: 0;
  border-radius: 14px;
}

.cost-record-identity strong,
.cost-record-identity span,
.cost-record-identity small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.cost-record-identity strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.cost-record-identity span,
.cost-record-identity small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.cost-record-summary,
.cost-record-financials {
  display: grid;
  align-content: stretch;
  gap: 7px;
  min-width: 0;
}

.cost-record-summary {
  grid-area: summary;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
}

.cost-record-financials {
  grid-area: financials;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cost-record-tags {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
}

.cost-record-metric {
  display: grid;
  min-width: 0;
  min-height: 52px;
  align-content: center;
  gap: 3px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
}

.cost-record-metric > span,
.cost-record-metric > small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.cost-record-metric > strong,
.cost-record-metric > b {
  color: var(--text);
  font-size: 13px;
  font-weight: 880;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cost-record-metric.is-primary {
  border-color: rgba(0, 113, 227, 0.2);
  background: var(--blue-soft);
}

.cost-record-metric.is-primary > strong,
.cost-record-metric.is-primary > b {
  color: var(--blue);
}

.cost-record-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 7px;
  min-width: 0;
}

.cost-record-actions .button,
.cost-record-actions .row-button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding-inline: 8px;
  white-space: normal;
}

@media (max-width: 1180px) and (min-width: 901px) {
  .cost-record-card {
    grid-template-areas:
      "select summary actions"
      ". financials financials";
    grid-template-columns: 44px minmax(0, 1fr) minmax(180px, 0.5fr);
  }
}

@media (max-width: 900px) {
  body[data-admin-surface="product"] #costsView #costsTableContainer {
    overflow-x: clip !important;
  }

  /* Sticky toolbars must not be trapped by the desktop paint/scroll boundary. */
  body[data-admin-surface="product"] #recipesView .product-library-panel,
  body[data-admin-surface="product"] #materialsView .library-floating-panel,
  body[data-admin-surface="product"] #suppliesView .library-floating-panel,
  body[data-admin-surface="product"] #costsView .cost-library-panel {
    contain: none !important;
    overflow: visible !important;
  }

  /* A tall sticky filter card obscured between 40% and 80% of the viewport. */
  .product-library-panel > .advanced-toolbar,
  .library-floating-panel > .table-toolbar,
  .cost-library-panel > .advanced-toolbar,
  #supplyOffersView .supply-offer-sticky-stack,
  #supplyOffersView .table-sort-note,
  #supplyOffersView .supply-offer-table thead th {
    position: static;
    top: auto;
    max-height: none;
  }

  .product-library-panel > .advanced-toolbar,
  .library-floating-panel > .table-toolbar,
  .cost-library-panel > .advanced-toolbar,
  #supplyOffersView .supply-offer-sticky-stack {
    overflow: visible;
    overscroll-behavior: auto;
  }

  .product-library-panel > .advanced-toolbar,
  .library-floating-panel > .table-toolbar,
  .cost-library-panel > .advanced-toolbar {
    margin: 0 0 12px;
    padding: 12px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
  }

  #supplyOffersView .supply-offer-sticky-stack {
    gap: 10px;
    margin: 12px 0;
    padding: 0;
    background: transparent;
  }

  #supplyOffersView .supply-offer-toolbar-card {
    padding: 12px;
    border-radius: 16px;
  }

  .advanced-toolbar,
  .table-toolbar {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  .advanced-toolbar .filter-stack,
  .table-toolbar .filter-stack,
  .advanced-toolbar .filter-row,
  .table-toolbar .filter-row,
  .advanced-toolbar .range-filter-row,
  .table-toolbar .range-filter-row,
  .advanced-toolbar .bulk-toolbar-actions,
  .table-toolbar .toolbar-actions {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .product-library-panel .filter-row,
  .library-floating-panel .filter-row,
  #costsView .filter-row,
  #supplyOffersView .filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .product-library-panel .filter-row > .search-box,
  .library-floating-panel .filter-row > .search-box,
  #costsView .filter-row > .search-box,
  #supplyOffersView .filter-row > .search-box {
    position: static;
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .product-library-panel .filter-row > .select-control,
  .library-floating-panel .filter-row > .select-control,
  #costsView .filter-row > .select-control,
  #supplyOffersView .filter-row > .select-control {
    width: 100%;
    min-width: 0;
  }

  .advanced-toolbar .range-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-toolbar .price-range-filter {
    width: 100%;
    min-width: 0;
  }

  .bulk-toolbar-actions,
  .table-toolbar .toolbar-actions,
  #supplyOffersView .supply-offer-toolbar-card .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    align-items: stretch;
    gap: 8px;
    overflow: visible;
    padding: 0;
  }

  .bulk-toolbar-actions .selection-summary,
  .bulk-toolbar-actions .basis-chip {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .bulk-toolbar-actions .button,
  .table-toolbar .toolbar-actions .button,
  #supplyOffersView .supply-offer-toolbar-card .toolbar-actions .button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .feature-check-strip {
    overflow: visible;
    flex-wrap: wrap;
    scrollbar-width: auto;
  }

  .feature-check-strip > span {
    min-width: 0;
    flex: 0 1 auto;
    white-space: normal;
  }

  /* Touch targets: visual controls may remain compact inside a 44px hit area. */
  .button,
  .button.small,
  .row-button,
  .icon-button,
  .section-tab,
  .nav-subitem,
  .birthday-fold-toggle,
  .pagination-button,
  .pagination-size,
  .link-button {
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .link-button,
  .birthday-fold-toggle {
    display: inline-flex;
    align-items: center;
  }

  .selectable-table input[type="checkbox"],
  .cost-record-select input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  .amount-fx-button {
    right: 2px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .formula-input-shell,
  .formula-fixed-input,
  .quote-price-formula .input-prefix {
    padding-right: 50px;
  }

  .formula-input-shell > input,
  .formula-fixed-input input {
    padding-right: 50px !important;
  }

  /* New cost record cards supplied by the cost renderer. */
  .cost-record-list {
    gap: 10px;
  }

  .cost-record-card {
    position: relative;
    grid-template-areas:
      "summary"
      "financials"
      "actions";
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 10px;
    overflow: visible;
    border-radius: 16px;
  }

  .cost-record-select {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
  }

  .cost-record-identity {
    min-height: 56px;
    padding-right: 52px;
  }

  .cost-record-identity .record-image-button {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .cost-record-summary,
  .cost-record-financials {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .cost-record-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .cost-record-metric {
    min-height: 44px;
    padding: 6px;
  }

  .cost-record-actions {
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    gap: 6px;
  }

  body[data-admin-surface="product"] #costsView .cost-record-actions .button,
  body[data-admin-surface="product"] #costsView .cost-record-actions .row-button {
    min-height: 44px !important;
  }

  .cost-result-toolbar {
    position: static;
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 12px;
  }

  .cost-select-all {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
  }

  .cost-select-all input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--blue);
  }

  /* Compact semantic cards for material, supply and supply-offer tables. */
  #materialsTableContainer,
  #suppliesTableContainer,
  #supplyOffersTableContainer,
  #costsTableContainer {
    overflow: visible;
    contain: none;
  }

  #materialsTableContainer .library-table,
  #suppliesTableContainer .library-table,
  #supplyOffersTableContainer .supply-offer-table,
  #costsTableContainer .responsive-cost-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-spacing: 0 !important;
    table-layout: auto !important;
    background: transparent;
  }

  #materialsTableContainer .library-table colgroup,
  #suppliesTableContainer .library-table colgroup,
  #supplyOffersTableContainer .supply-offer-table colgroup,
  #costsTableContainer .responsive-cost-table colgroup,
  #materialsTableContainer .library-table thead,
  #suppliesTableContainer .library-table thead,
  #supplyOffersTableContainer .supply-offer-table thead,
  #costsTableContainer .responsive-cost-table thead {
    display: none !important;
  }

  #materialsTableContainer .library-table tbody,
  #suppliesTableContainer .library-table tbody,
  #supplyOffersTableContainer .supply-offer-table tbody,
  #costsTableContainer .responsive-cost-table tbody {
    display: grid !important;
    width: 100%;
    gap: 10px;
  }

  #materialsTableContainer .library-table tbody tr,
  #suppliesTableContainer .library-table tbody tr,
  #supplyOffersTableContainer .supply-offer-table tbody tr,
  #costsTableContainer .responsive-cost-table tbody tr {
    position: relative;
    display: grid !important;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: visible;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  #materialsTableContainer .library-table tbody td,
  #suppliesTableContainer .library-table tbody td,
  #supplyOffersTableContainer .supply-offer-table tbody td,
  #costsTableContainer .responsive-cost-table tbody td {
    display: grid !important;
    min-width: 0 !important;
    min-height: 44px !important;
    align-content: center;
    gap: 3px;
    padding: 6px 8px !important;
    overflow: visible !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    color: var(--text);
    font-size: 11px;
    line-height: 1.3;
    text-align: left !important;
    text-overflow: clip !important;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  #materialsTableContainer .library-table tbody td::before,
  #suppliesTableContainer .library-table tbody td::before,
  #supplyOffersTableContainer .supply-offer-table tbody td::before,
  #costsTableContainer .responsive-cost-table tbody td::before {
    display: block;
    content: attr(data-label);
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
  }

  #materialsTableContainer .library-table tbody td.primary-cell,
  #suppliesTableContainer .library-table tbody td.primary-cell,
  #supplyOffersTableContainer .supply-offer-table tbody td.primary-cell,
  #costsTableContainer .responsive-cost-table tbody td.primary-cell {
    order: -10;
    grid-column: 1 / -1;
    min-height: 68px !important;
    padding: 10px 58px 10px 70px !important;
    border-right: 0 !important;
    background: linear-gradient(90deg, var(--blue-soft), #fff);
  }

  #supplyOffersTableContainer .supply-offer-table tbody td.primary-cell {
    padding-left: 12px !important;
  }

  #materialsTableContainer .library-table tbody td.primary-cell::before,
  #suppliesTableContainer .library-table tbody td.primary-cell::before,
  #supplyOffersTableContainer .supply-offer-table tbody td.primary-cell::before,
  #costsTableContainer .responsive-cost-table tbody td.primary-cell::before,
  #materialsTableContainer .library-table tbody td.actions-cell::before,
  #suppliesTableContainer .library-table tbody td.actions-cell::before,
  #supplyOffersTableContainer .supply-offer-table tbody td.actions-cell::before,
  #costsTableContainer .responsive-cost-table tbody td.actions-cell::before,
  #materialsTableContainer .library-table tbody td.image-cell::before,
  #suppliesTableContainer .library-table tbody td.image-cell::before,
  #costsTableContainer .responsive-cost-table tbody td.image-cell::before,
  #materialsTableContainer .library-table tbody td.select-cell::before,
  #suppliesTableContainer .library-table tbody td.select-cell::before,
  #supplyOffersTableContainer .supply-offer-table tbody td.select-cell::before,
  #costsTableContainer .responsive-cost-table tbody td.select-cell::before {
    display: none;
  }

  #materialsTableContainer .library-table tbody td.image-cell,
  #suppliesTableContainer .library-table tbody td.image-cell,
  #costsTableContainer .responsive-cost-table tbody td.image-cell {
    position: absolute !important;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: grid !important;
    width: 48px !important;
    height: 48px;
    min-height: 48px !important;
    place-items: center;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  #materialsTableContainer .library-table tbody td.image-cell .record-image-button,
  #suppliesTableContainer .library-table tbody td.image-cell .record-image-button,
  #costsTableContainer .responsive-cost-table tbody td.image-cell .record-image-button {
    width: 48px !important;
    height: 48px !important;
    margin: 0;
    border-radius: 13px;
  }

  #materialsTableContainer .library-table tbody td.select-cell,
  #suppliesTableContainer .library-table tbody td.select-cell,
  #supplyOffersTableContainer .supply-offer-table tbody td.select-cell,
  #costsTableContainer .responsive-cost-table tbody td.select-cell {
    position: absolute !important;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: grid !important;
    width: 44px !important;
    height: 44px;
    min-width: 44px !important;
    min-height: 44px !important;
    place-items: center;
    padding: 0 !important;
    border: 1px solid var(--line) !important;
    border-radius: 11px;
    background: #fff !important;
  }

  #materialsTableContainer .library-table tbody td.actions-cell,
  #suppliesTableContainer .library-table tbody td.actions-cell,
  #supplyOffersTableContainer .supply-offer-table tbody td.actions-cell,
  #costsTableContainer .responsive-cost-table tbody td.actions-cell {
    order: 10;
    grid-column: 1 / -1;
    min-height: 0 !important;
    padding: 7px !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    background: var(--panel-soft);
  }

  #materialsTableContainer .library-table .row-actions,
  #suppliesTableContainer .library-table .row-actions,
  #supplyOffersTableContainer .supply-offer-table .row-actions,
  #costsTableContainer .responsive-cost-table .row-actions {
    display: grid !important;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  #costsTableContainer .responsive-cost-table .row-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #materialsTableContainer .library-table .row-button,
  #suppliesTableContainer .library-table .row-button,
  #supplyOffersTableContainer .supply-offer-table .row-button,
  #costsTableContainer .responsive-cost-table .row-button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 5px 7px;
    line-height: 1.25;
    white-space: normal;
  }

  #materialsTableContainer .price-overview,
  #suppliesTableContainer .price-overview,
  #supplyOffersTableContainer .supply-offer-price-cell,
  #costsTableContainer .responsive-cost-table .number,
  #costsTableContainer .responsive-cost-table .price-main,
  #costsTableContainer .responsive-cost-table .price-sub {
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  /* Product/recipe rows use the same dense three-column information grid. */
  #productsTableContainer {
    overflow: visible !important;
    contain: none;
  }

  #productsTableContainer .responsive-product-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-spacing: 0 !important;
    table-layout: auto !important;
    background: transparent !important;
  }

  #productsTableContainer .responsive-product-table caption,
  #productsTableContainer .responsive-product-table colgroup,
  #productsTableContainer .responsive-product-table thead {
    display: none !important;
  }

  #productsTableContainer .responsive-product-table tbody {
    display: grid !important;
    width: 100%;
    gap: 10px;
  }

  #productsTableContainer .responsive-product-table tbody tr {
    position: relative;
    display: grid !important;
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: visible !important;
    border: 1px solid var(--line) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: var(--shadow-sm) !important;
  }

  #productsTableContainer .responsive-product-table tbody td {
    display: grid !important;
    min-width: 0 !important;
    min-height: 44px !important;
    grid-column: auto !important;
    align-content: center;
    gap: 3px;
    padding: 6px 8px !important;
    overflow: visible !important;
    border: 0 !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    border-radius: 0 !important;
    color: var(--text) !important;
    background: #fff !important;
    font-size: 11px !important;
    line-height: 1.3;
    text-align: left !important;
    text-overflow: clip;
    white-space: normal !important;
    word-break: normal;
    overflow-wrap: anywhere;
    box-shadow: none !important;
  }

  #productsTableContainer .responsive-product-table tbody td::before {
    display: block !important;
    content: attr(data-label) !important;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
  }

  #productsTableContainer .responsive-product-table tbody td.primary-cell {
    order: -10;
    grid-column: 1 / -1 !important;
    min-height: 70px !important;
    padding: 10px 58px 10px 70px !important;
    border-right: 0 !important;
    background: linear-gradient(90deg, var(--blue-soft), #fff) !important;
  }

  #productsTableContainer .responsive-product-table tbody td.primary-cell::before,
  #productsTableContainer .responsive-product-table tbody td.actions-cell::before,
  #productsTableContainer .responsive-product-table tbody td.image-cell::before,
  #productsTableContainer .responsive-product-table tbody td.select-cell::before {
    display: none !important;
  }

  #productsTableContainer .responsive-product-table tbody td.image-cell {
    position: absolute !important;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: grid !important;
    width: 48px !important;
    height: 48px;
    min-height: 48px !important;
    place-items: center;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  #productsTableContainer .responsive-product-table tbody td.image-cell .record-image-button {
    width: 48px !important;
    height: 48px !important;
    margin: 0;
    border-radius: 13px !important;
  }

  #productsTableContainer .responsive-product-table tbody td.select-cell {
    position: absolute !important;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: grid !important;
    width: 44px !important;
    height: 44px;
    min-width: 44px !important;
    min-height: 44px !important;
    place-items: center;
    padding: 0 !important;
    border: 1px solid var(--line) !important;
    border-radius: 11px !important;
    background: #fff !important;
  }

  #productsTableContainer .responsive-product-table tbody td.size-cell,
  #productsTableContainer .responsive-product-table tbody td:nth-child(5),
  #productsTableContainer .responsive-product-table tbody td.product-cost-status-cell {
    display: none !important;
  }

  #productsTableContainer .responsive-product-table .product-cost-formula-value,
  #productsTableContainer .responsive-product-table .price-main,
  #productsTableContainer .responsive-product-table .price-sub,
  #productsTableContainer .responsive-product-table td.number,
  #productsTableContainer .responsive-product-table .latest-log,
  #productsTableContainer .responsive-product-table .latest-log > * {
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    text-align: left !important;
    text-overflow: clip;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  #productsTableContainer .responsive-product-table tbody td.log-cell {
    grid-column: auto !important;
    min-height: 44px !important;
  }

  #productsTableContainer .responsive-product-table .inline-log-button {
    min-height: 44px;
    text-align: left;
  }

  #productsTableContainer .responsive-product-table tbody td.actions-cell {
    order: 10;
    grid-column: 1 / -1 !important;
    min-height: 0 !important;
    padding: 7px !important;
    border-right: 0 !important;
    border-bottom: 0 !important;
    background: var(--panel-soft) !important;
  }

  #productsTableContainer .responsive-product-table .row-actions {
    display: grid !important;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  #productsTableContainer .responsive-product-table .row-button {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 5px !important;
    font-size: 11px !important;
    line-height: 1.2;
    white-space: normal !important;
  }

  #productsTableContainer .responsive-product-table tbody tr.birthday-fold-row td.birthday-fold-summary-cell {
    order: -10;
    display: block !important;
    grid-column: 1 / -1 !important;
    min-height: 0 !important;
    padding: 10px 58px 10px 70px !important;
    border: 0 !important;
    background: linear-gradient(90deg, var(--blue-soft), #fff) !important;
  }

  #productsTableContainer .responsive-product-table tbody tr.birthday-fold-row td.birthday-fold-summary-cell::before {
    display: none !important;
  }

  #productsTableContainer .birthday-fold-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  #productsTableContainer .birthday-fold-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  #productsTableContainer .birthday-fold-metric {
    min-width: 0;
    min-height: 44px;
    padding: 6px;
  }

  #productsTableContainer .birthday-fold-side {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
  }

  #productsTableContainer .birthday-fold-side small {
    white-space: normal;
  }

  #productsTableContainer .birthday-fold-action-row {
    display: grid;
    min-width: min(100%, 180px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-left: auto;
  }

  #productsTableContainer .birthday-fold-action-row .row-button {
    min-height: 44px !important;
  }

  /* Override the later brand layer's former two-column/70px mobile recipe row. */
  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row {
    position: relative !important;
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0 !important;
    padding: 10px !important;
    overflow: visible !important;
    border: 1px solid var(--line) !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: var(--shadow-sm) !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td {
    position: static !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
    display: grid !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 44px !important;
    grid-column: auto !important;
    grid-row: auto !important;
    align-content: center !important;
    gap: 3px !important;
    padding: 6px 8px !important;
    overflow: visible !important;
    border: 0 !important;
    border-right: 1px solid var(--line) !important;
    border-bottom: 1px solid var(--line) !important;
    background: #fff !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-detail-only {
    display: none !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.select-cell {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 3 !important;
    display: grid !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    place-items: center !important;
    padding: 0 !important;
    border: 1px solid var(--line) !important;
    border-radius: 11px !important;
    background: #fff !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.image-cell {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 2 !important;
    display: grid !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    place-items: center !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.image-cell .record-image-button {
    width: 48px !important;
    height: 48px !important;
    margin: 0 !important;
    border-radius: 13px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-identity-cell {
    order: -10;
    grid-column: 1 / -1 !important;
    min-height: 70px !important;
    padding: 10px 52px 10px 60px !important;
    border-right: 0 !important;
    background: linear-gradient(90deg, var(--blue-soft), #fff) !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-formula-cell,
  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-total-cell,
  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-pricing-cell,
  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-average-cell,
  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-status-cell {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 52px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-actions-cell {
    order: 10;
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    min-height: 0 !important;
    padding: 7px !important;
    border: 0 !important;
    background: var(--panel-soft) !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-actions-cell .row-actions {
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.product-cost-summary-row > td.product-cost-actions-cell .row-button,
  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table .inline-log-button {
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 5px !important;
    font-size: 11px !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.birthday-fold-row {
    position: relative !important;
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 10px !important;
    overflow: visible !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.birthday-fold-row > td.select-cell {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 3 !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.birthday-fold-row > td.image-cell {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    z-index: 2 !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .responsive-product-table tbody tr.birthday-fold-row > td.birthday-fold-summary-cell {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-title-block {
    min-height: 56px !important;
    padding: 0 52px 0 60px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 5px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-metric {
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 6px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-side {
    display: flex !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-action-row {
    display: grid !important;
    width: min(100%, 190px) !important;
    min-width: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    margin-left: auto !important;
  }

  body[data-admin-surface="product"] #recipesView #productsTableContainer .birthday-fold-action-row .row-button {
    min-height: 44px !important;
    white-space: normal !important;
  }

  .table-pagination {
    position: static;
  }

  .pagination-button,
  .pagination-size {
    min-height: 44px;
  }

  /* The disclosure button is the only sticky surface while collapsed. */
  body[data-admin-surface="product"] .mobile-filter-toolbar {
    position: sticky !important;
    top: var(--product-sticky-top, 0px) !important;
    z-index: 26;
    display: grid !important;
    width: 100%;
    min-width: 0;
    max-height: 68px !important;
    overflow: hidden !important;
    overscroll-behavior: contain;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
  }

  body[data-admin-surface="product"] .mobile-filter-toolbar > .mobile-filter-toggle {
    display: grid !important;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    grid-template-columns: minmax(0, 1fr) auto 24px;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(0, 113, 227, 0.18);
    border-radius: 12px;
    color: var(--text);
    background: linear-gradient(180deg, #fff, #f7fbff);
    box-shadow: var(--shadow-sm);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .mobile-filter-toggle > span {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-filter-toggle > small {
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
  }

  .mobile-filter-toggle > i {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    color: var(--blue);
    font-size: 18px;
    font-style: normal;
    transition: transform 150ms var(--ease);
  }

  body[data-admin-surface="product"] .mobile-filter-toolbar:not(.is-mobile-expanded) > :not(.mobile-filter-toggle) {
    display: none !important;
  }

  body[data-admin-surface="product"] .mobile-filter-toolbar.is-mobile-expanded {
    max-height: calc(100dvh - var(--product-sticky-top, 0px) - 12px) !important;
    overflow: auto !important;
    padding-bottom: 12px;
    scrollbar-gutter: stable;
  }

  body[data-admin-surface="product"] .mobile-filter-toolbar.is-mobile-expanded > .mobile-filter-toggle {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  body[data-admin-surface="product"] .mobile-filter-toolbar.is-mobile-expanded .mobile-filter-toggle > i {
    transform: rotate(180deg);
  }

  /* The supply-offer category shortcuts share the same disclosure state. */
  #supplyOffersView .supply-offer-sticky-stack {
    position: sticky !important;
    top: var(--product-sticky-top, 0px) !important;
    z-index: 26;
    max-height: 68px !important;
    overflow: hidden !important;
    background: transparent;
  }

  #supplyOffersView .supply-offer-toolbar-card {
    order: -1;
  }

  #supplyOffersView .supply-offer-category-jumps {
    order: 1;
  }

  #supplyOffersView .supply-offer-sticky-stack .mobile-filter-toolbar {
    position: static !important;
    top: auto !important;
  }

  #supplyOffersView .supply-offer-sticky-stack:has(.mobile-filter-toolbar:not(.is-mobile-expanded)) .supply-offer-category-jumps {
    display: none;
  }

  #supplyOffersView .supply-offer-sticky-stack:has(.mobile-filter-toolbar.is-mobile-expanded) {
    max-height: calc(100dvh - var(--product-sticky-top, 0px) - 12px) !important;
    overflow: auto !important;
    padding-bottom: 12px;
    background: rgba(245, 245, 247, 0.98);
    overscroll-behavior: contain;
  }

  #supplyOffersView .supply-offer-sticky-stack:has(.mobile-filter-toolbar.is-mobile-expanded) .mobile-filter-toolbar {
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 480px) {
  .product-library-panel .filter-row,
  .library-floating-panel .filter-row,
  #costsView .filter-row,
  #supplyOffersView .filter-row,
  .advanced-toolbar .range-filter-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .advanced-toolbar .range-filter-row > *,
  .product-library-panel .filter-row > *,
  .library-floating-panel .filter-row > *,
  #costsView .filter-row > *,
  #supplyOffersView .filter-row > * {
    grid-column: 1;
  }

  .bulk-toolbar-actions,
  .table-toolbar .toolbar-actions,
  #supplyOffersView .supply-offer-toolbar-card .toolbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bulk-toolbar-actions .selection-summary,
  .bulk-toolbar-actions .basis-chip {
    grid-column: 1 / -1;
  }

  .cost-record-card,
  #materialsTableContainer .library-table tbody tr,
  #suppliesTableContainer .library-table tbody tr,
  #supplyOffersTableContainer .supply-offer-table tbody tr,
  #costsTableContainer .responsive-cost-table tbody tr {
    max-width: 100%;
  }

  .cost-record-summary,
  .cost-record-financials {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cost-record-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .cost-record-metric > span,
  .cost-record-metric > small {
    font-size: 9px;
    line-height: 1.15;
  }

  .cost-record-metric > strong,
  .cost-record-metric > b {
    font-size: 11px;
    line-height: 1.2;
  }

  body[data-admin-surface="product"] #costsView .cost-record-metric {
    min-height: 40px;
    gap: 2px;
    padding: 4px;
  }

  body[data-admin-surface="product"] #costsView .cost-record-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-admin-surface="product"] #costsView .cost-record-actions .button,
  body[data-admin-surface="product"] #costsView .cost-record-actions .row-button {
    padding-inline: 4px !important;
    font-size: 12px;
    line-height: 1.15;
  }

  /* Product editor: keep every grid track inside the 320px viewport. */
  .modal-editor {
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
  }

  .modal-editor > .modal-body.product-modal-body {
    width: 100%;
    max-width: 100%;
    padding: 0 !important;
    overflow-x: hidden;
    scroll-padding-top: 12px;
  }

  .product-editor-layout,
  .product-editor-rail,
  .product-editor-main,
  .product-editor-main .form-section,
  .formula-workbench,
  .formula-title-row,
  .form-grid,
  .dessert-price-panel,
  .formula-table-wrap,
  .formula-table,
  .formula-table tbody,
  .formula-table tr[data-line-id] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .product-editor-layout {
    display: block;
    overflow-x: hidden;
  }

  .product-editor-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    overflow-x: hidden;
  }

  .product-editor-main .form-section {
    padding: 12px;
    overflow: visible;
    border-radius: 14px;
  }

  .form-grid.cols-3,
  .form-grid.cols-4,
  .dessert-price-panel,
  .formula-table tr[data-line-id] {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4,
  .formula-table tr[data-line-id] td {
    grid-column: 1;
  }

  .formula-title-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .formula-title-row .formula-actions,
  .formula-actions {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 10px 0 0;
  }

  .formula-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding-inline: 7px;
    white-space: normal;
  }

  .formula-table-wrap {
    overflow-x: hidden;
  }

  .formula-table tr[data-line-id] td:nth-child(n) {
    grid-column: 1;
  }

  .product-editor-main input,
  .product-editor-main select,
  .product-editor-main textarea,
  .formula-item-cell,
  .formula-item-picker,
  .formula-item-picker select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .product-compare-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .product-compare-table th,
  .product-compare-table td {
    min-width: 144px;
    padding: 12px;
  }

  .product-compare-table tr > th[scope="row"],
  .product-compare-table .compare-head th:first-child {
    min-width: 108px;
  }

  .modal-editor .modal-footer {
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }
}
