:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e3ef;
  --blue: #153d5f;
  --blue-soft: #e9f2fb;
  --gold: #ffc94a;
  --green: #80c85b;
  --red: #d94d3f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #153d5f, #2d5f82);
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.26);
}

.login-card h1 {
  color: var(--blue);
}

.login-card button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
}

.login-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.login-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 9px 12px 8px;
  color: #fff;
  background: linear-gradient(135deg, #153d5f, #225a83);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.18);
}

.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-header .eyebrow {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.78);
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 20px;
}

.ghost {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.header-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: nowrap;
}

.user-badge {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.96);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 34px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.pill-link:hover {
  background: rgba(255, 255, 255, 0.22);
}

.account-menu-button {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: transparent;
}

.account-menu-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.78);
  outline-offset: 2px;
}

.menu-lines {
  width: 26px;
  display: grid;
  gap: 5px;
}

.menu-lines i {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.menu-lines i:nth-child(3) {
  width: 15px;
  justify-self: end;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  width: 152px;
  overflow: hidden;
  border: 1px solid #d6e1ec;
  border-radius: 14px;
  color: #102033;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.account-menu-item {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid #edf1f6;
  color: #102033;
  background: #fff;
  text-align: left;
  font-size: 15px;
}

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

.account-menu-item.danger {
  color: #b42318;
}

.account-menu-item:active {
  background: #f3f6fa;
}

.hidden {
  display: none;
}

.search-box {
  display: grid;
  gap: 0;
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}

.search-box span {
  display: none;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 7px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
}

.mode-switch button {
  min-height: 31px;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  font-weight: 800;
}

.mode-switch button.active {
  color: var(--blue);
  background: #fff;
}

.quick-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 10px;
}

.app-header > .quick-filters {
  display: none;
}

.list-quick-filters {
  padding: 0;
  margin-bottom: 8px;
}

.chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  white-space: nowrap;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.chip.active {
  color: var(--blue);
  background: #fff;
}

.list-quick-filters .chip {
  border-color: #d4e0ea;
  color: var(--blue);
  background: #eef4fa;
  font-weight: 800;
}

.list-quick-filters .chip.active {
  color: #fff;
  background: var(--blue);
}

main {
  padding: 12px 12px 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stats-grid article {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  background: var(--panel);
}

.stats-grid strong {
  display: block;
  font-size: 19px;
  color: var(--blue);
}

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

.toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.toolbar select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 10px;
  background: #fff;
}

.toolbar-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toolbar-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--blue);
  font-weight: 800;
  background: #fff;
}

.toolbar-actions button:nth-child(2) {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.customer-search-view {
  display: grid;
  gap: 10px;
}

.customer-search-view.hidden {
  display: none;
}

.customer-search-card {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.customer-search-card label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.customer-search-card input {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.customer-search-card button,
.customer-product-card button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.customer-search-status {
  padding: 10px 12px;
  border-radius: 12px;
  color: #476273;
  background: #edf4fb;
  font-size: 13px;
  line-height: 1.5;
}

.customer-name-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.customer-name-chips button {
  flex: 0 0 auto;
  max-width: 190px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c9dbea;
  border-radius: 999px;
  color: #234761;
  background: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-product-list {
  display: grid;
  gap: 10px;
}

.customer-product-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}

.customer-product-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.customer-product-head p {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.customer-product-head h2 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.customer-product-head strong {
  color: #102132;
  font-size: 28px;
  line-height: 1;
  white-space: nowrap;
}

.customer-product-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-product-facts span {
  padding: 5px 7px;
  border-radius: 8px;
  color: #26364d;
  background: #f1f5f9;
  font-size: 12px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}

.thumb {
  position: relative;
  overflow: hidden;
  width: 86px;
  height: 86px;
  border-radius: 12px;
  background: var(--blue-soft);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: #edf2f7;
}

.badge.s {
  background: var(--gold);
}

.badge.a {
  background: var(--green);
}

.badge.b {
  background: #dce8d4;
}

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

.product-name {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

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

.metrics span {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 54px;
  text-align: center;
  padding: 6px 7px;
  border-radius: 10px;
  color: #533100;
  background: #fff3c4;
  font-size: 12px;
}

.metrics b {
  font-size: 12px;
  line-height: 1.1;
}

.metrics strong {
  color: #111827;
  font-size: 16px;
  line-height: 1.05;
}

.metrics .owner-chip {
  color: #533100;
  background: #fff3c4;
}

.list-pager {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  text-align: center;
}

.list-pager button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
}

.list-pager button:disabled {
  color: var(--muted);
  background: #e5e7eb;
}

.detail-actions button,
.camera-button,
.share-photos-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--blue);
}

.detail-actions button:nth-child(2) {
  color: var(--blue);
  background: var(--blue-soft);
}

.detail-dialog {
  width: min(94vw, 720px);
  max-height: 94dvh;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
}

.detail-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.detail-card {
  display: grid;
  gap: 12px;
  max-height: 94dvh;
  overflow-y: auto;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-head .eyebrow {
  color: var(--muted);
}

.detail-head h2 {
  font-size: 21px;
  line-height: 1.35;
}

.close-button {
  flex: 0 0 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  font-size: 25px;
  color: var(--muted);
  background: #f2f4f7;
}

.photo-panel {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border-radius: 16px;
  background: #edf3f8;
}

.photo-panel.has-photo::after {
  content: "点按放大";
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(21, 61, 95, 0.78);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.photo-main-tag,
.photo-count-tag {
  position: absolute;
  z-index: 2;
  top: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.photo-main-tag {
  left: 10px;
  background: rgba(19, 114, 93, 0.86);
}

.photo-count-tag {
  right: 10px;
  background: rgba(21, 61, 95, 0.78);
}

.photo-panel img {
  display: none;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #f8fafc;
}

.photo-panel img.can-zoom {
  cursor: zoom-in;
}

#photoPlaceholder,
#editorPhotoPlaceholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.photo-thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.photo-thumb {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #eef4f8;
}

.photo-thumb.active {
  border-color: var(--blue);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb b {
  position: absolute;
  left: 4px;
  top: 4px;
  z-index: 1;
  padding: 2px 5px;
  border-radius: 999px;
  color: #fff;
  background: rgba(19, 114, 93, 0.9);
  font-size: 10px;
}

.photo-add-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border: 1px dashed #9db5c7;
  border-radius: 12px;
  color: var(--blue);
  background: #fff;
  font-size: 26px;
  font-weight: 800;
}

.camera-button {
  display: grid;
  place-items: center;
}

.detail-photo-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
}

.camera-button[type="button"] {
  width: 100%;
}

.share-photos-button {
  color: var(--blue);
  background: var(--blue-soft);
}

.share-photos-button:disabled {
  color: #98a2b3;
  background: #eef1f5;
}

.camera-button input {
  display: none;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 800;
}

.photo-actions button.delete-photo {
  color: #a23a32;
  background: #fff0ed;
}

.photo-actions button:disabled {
  color: #98a2b3;
  background: #eef1f5;
}

.file-name {
  margin: 0;
  padding: 10px;
  border-radius: 10px;
  color: #5a4812;
  word-break: break-all;
  background: #fff7d6;
  font-size: 13px;
}

.file-name:empty {
  display: none;
}

.photo-zoom-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  background: rgba(8, 15, 24, 0.96);
}

.photo-zoom-dialog::backdrop {
  background: rgba(8, 15, 24, 0.82);
}

.photo-zoom-dialog img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 54px 10px 18px;
}

.photo-zoom-close {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  font-size: 28px;
  line-height: 1;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.detail-metrics div {
  padding: 10px 6px;
  border-radius: 12px;
  text-align: center;
  background: #f4f7fb;
}

.detail-metrics span {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--muted);
}

.detail-metrics strong {
  font-size: 14px;
}

.customer-price-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #c9dbea;
  border-radius: 12px;
  background: #f2f7fc;
}

.customer-price-fold {
  padding: 0;
}

.customer-price-fold summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.customer-price-fold summary::-webkit-details-marker {
  display: none;
}

.customer-price-fold summary b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--blue);
  background: #fff;
  font-size: 24px;
  line-height: 1;
  transition: transform .16s ease;
}

.customer-price-fold[open] summary b {
  transform: rotate(90deg);
}

.customer-price-fold .customer-price-title {
  display: block;
  min-width: 0;
}

.customer-price-fold .customer-price-title span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-price-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.customer-price-title,
.customer-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.customer-price-title h3 {
  font-size: 16px;
  color: var(--blue);
}

.customer-price-title span,
.customer-block-title span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.customer-price-search input {
  background: #fff;
}

.customer-price-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.customer-price-chips button {
  flex: 0 0 auto;
  max-width: 180px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #c9dbea;
  border-radius: 999px;
  color: #234761;
  background: #fff;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-price-chips button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.customer-price-decision {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
}

.customer-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e6eef5;
}

.customer-match-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-match-row strong {
  overflow: hidden;
  max-width: 68%;
  color: var(--blue);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-price-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.customer-price-main span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-price-main strong {
  display: block;
  margin-top: 3px;
  color: #102132;
  font-size: 34px;
  line-height: 1;
}

.customer-price-main em {
  border: 1px solid #c9dbea;
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--blue);
  background: #f7fbff;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.customer-price-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-price-sub span {
  padding: 5px 7px;
  border-radius: 999px;
  color: #476273;
  background: #edf4fb;
  font-size: 12px;
}

.customer-quote-check {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  align-items: end;
}

.customer-quote-check input {
  font-size: 18px;
  font-weight: 800;
}

.customer-quote-check button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.quote-warning {
  min-height: 20px;
  padding: 10px;
  border-radius: 10px;
  color: #13715d;
  background: #eaf7f2;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.quote-warning:empty {
  display: none;
}

.quote-warning.caution {
  color: #80610f;
  background: #fff7d6;
}

.quote-warning.danger {
  color: #a23a32;
  background: #fff0ed;
}

.customer-price-history,
.customer-price-bars {
  display: grid;
  gap: 7px;
}

.customer-block-title strong {
  color: #102132;
  font-size: 14px;
}

.customer-history-row {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.customer-history-row strong {
  color: var(--blue);
  font-size: 16px;
}

.customer-price-bar {
  display: grid;
  grid-template-columns: 62px 1fr 38px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.customer-price-bar strong {
  color: #102132;
}

.customer-price-bar span {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(21, 61, 95, .13);
}

.customer-price-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.customer-price-bar em {
  font-style: normal;
  text-align: right;
}

.customer-price-empty {
  padding: 12px;
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.owner-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #f2d67b;
  border-radius: 12px;
  background: #fff8df;
}

.owner-panel.hidden {
  display: none;
}

.owner-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.owner-summary-strip div {
  min-width: 0;
  padding: 9px 6px;
  border-radius: 10px;
  text-align: center;
  background: #fff;
}

.owner-summary-strip span {
  display: block;
  margin-bottom: 3px;
  color: #80610f;
  font-size: 12px;
}

.owner-summary-strip strong {
  font-size: 15px;
}

.owner-accordion {
  overflow: hidden;
  border: 1px solid #eadb9c;
  border-radius: 12px;
  background: #fffdf2;
}

.owner-accordion summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}

.owner-accordion summary::-webkit-details-marker {
  display: none;
}

.owner-accordion summary strong {
  display: block;
  color: #101828;
  font-size: 15px;
}

.owner-accordion summary span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #8a690f;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-accordion summary b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--blue);
  background: #fff;
  font-size: 22px;
  line-height: 1;
  transition: transform .16s ease;
}

.owner-accordion[open] summary b {
  transform: rotate(90deg);
}

.owner-accordion-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.owner-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.owner-metrics div {
  padding: 9px 6px;
  border-radius: 10px;
  text-align: center;
  background: #fff;
}

.owner-metrics span {
  display: block;
  margin-bottom: 3px;
  color: #80610f;
  font-size: 12px;
}

.owner-metrics strong {
  font-size: 14px;
}

.owner-edit-grid {
  grid-template-columns: 1fr 1fr;
}

.supplier-card {
  display: grid;
  gap: 12px;
  margin: 14px 0 10px;
  padding-top: 12px;
  border-top: 1px solid #eadb9c;
}

.supplier-title,
.variant-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.supplier-title strong,
.variant-title strong {
  color: #101828;
  font-size: 17px;
  line-height: 1.2;
}

.variant-title span {
  color: #9b760d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.supplier-recommend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(16, 24, 40, .04);
}

.supplier-recommend div {
  min-width: 0;
}

.supplier-recommend span,
.supplier-table-head,
.variant-tag,
.variant-more,
.supplier-empty,
.market-examples > span {
  color: #667085;
  font-size: 12px;
}

.supplier-recommend strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: #101828;
  font-size: 16px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-recommend div:first-child strong {
  color: #0f496b;
  font-size: 20px;
}

.supplier-price.good {
  color: #16735d;
}

.supplier-price.high {
  color: #9b332b;
}

.supplier-table {
  display: grid;
  gap: 0;
}

.supplier-table-head,
.supplier-row {
  display: grid;
  grid-template-columns: minmax(76px, 1.25fr) minmax(58px, .78fr) minmax(54px, .72fr) minmax(64px, .86fr) minmax(70px, .96fr);
  gap: 8px;
  align-items: center;
}

.supplier-table-head {
  padding: 10px 0 6px;
  border-bottom: 1px solid #e9dfaf;
  font-weight: 700;
}

.supplier-row {
  min-height: 48px;
  padding: 8px 0;
  color: #101828;
  font-size: 13px;
}

.supplier-row + .supplier-row {
  border-top: 1px solid rgba(233, 223, 175, .45);
}

.supplier-row .supplier-name,
.supplier-row span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-row strong {
  font-size: 17px;
}

.supplier-row small {
  display: block;
  margin-top: 2px;
  color: #667085;
  font-size: 11px;
}

.supplier-variants {
  border-top: 1px solid #e9dfaf;
  padding-top: 14px;
}

.owner-accordion-body .supplier-variants {
  border-top: 0;
  padding-top: 0;
}

.stock-sources {
  display: grid;
  gap: 10px;
}

.stock-source-total {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stock-source-total div {
  min-width: 0;
  padding: 10px 8px;
  border-radius: 12px;
  text-align: center;
  background: #fff;
}

.stock-source-total span {
  display: block;
  margin-bottom: 3px;
  color: #80610f;
  font-size: 12px;
}

.stock-source-total strong {
  display: block;
  overflow: hidden;
  color: #101828;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-source-total div:last-child {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  text-align: left;
}

.stock-source-total div:last-child span {
  margin-bottom: 0;
}

.stock-source-total div:last-child strong {
  overflow: visible;
  font-size: 15px;
  text-align: right;
  text-overflow: clip;
  white-space: normal;
}

.stock-source-list {
  display: grid;
  gap: 8px;
}

.stock-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, auto);
  gap: 8px 12px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(16, 24, 40, .04);
}

.stock-source-row > div:first-child {
  min-width: 0;
}

.stock-source-row strong {
  color: #101828;
}

.stock-source-row > div:first-child strong {
  display: block;
  overflow: hidden;
  color: #0f496b;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-source-row small,
.stock-source-cost,
.stock-source-qty span {
  color: #667085;
  font-size: 12px;
}

.stock-source-row small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-source-qty {
  text-align: right;
}

.stock-source-qty strong {
  display: block;
  color: #16735d;
  font-size: 20px;
  line-height: 1.15;
}

.stock-source-cost {
  grid-column: 1 / -1;
}

.stock-source-row.empty-stock .stock-source-qty strong {
  color: #667085;
}

.market-examples {
  display: grid;
  gap: 7px;
  padding-top: 10px;
}

.market-examples div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.market-examples em {
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  color: #344054;
  background: #fffdf2;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.variant-card {
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
}

.variant-card strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #101828;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.variant-pills span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #667085;
  background: #f0f4f8;
  font-size: 12px;
  line-height: 1.1;
}

.variant-more {
  margin: 8px 0 0;
}

.supplier-empty {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
}

.owner-price-editor {
  margin-top: 4px;
}

.owner-price-editor input {
  font-size: 18px;
  font-weight: 700;
}

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

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

label input,
label select,
label textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 400;
}

label textarea {
  min-height: 72px;
  resize: vertical;
}

.raw-info {
  padding: 12px;
  border-radius: 12px;
  background: #f8fafc;
}

.raw-info h3 {
  margin-bottom: 6px;
  font-size: 14px;
}

.raw-info p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.detail-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 -14px -14px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}

.compact-card {
  width: min(92vw, 430px);
}

.security-card {
  width: min(94vw, 760px);
  gap: 14px;
}

.security-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.security-collapsible summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 17px;
  font-weight: 900;
  list-style: none;
}

.security-collapsible summary::-webkit-details-marker {
  display: none;
}

.security-collapsible:not([open]) {
  display: block;
}

.security-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.security-title p,
.security-section > p,
.security-log-tools p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.security-title button,
.security-log-tools button,
.security-primary,
.security-editor-actions button,
.security-danger-zone button {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

.security-log-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.security-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.security-summary span {
  display: grid;
  gap: 2px;
  min-height: 58px;
  align-content: center;
  justify-items: center;
  border: 1px solid #d8e4ef;
  border-radius: 12px;
  background: #fff;
}

.security-summary strong {
  color: var(--blue);
  font-size: 22px;
  line-height: 1;
}

.security-summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.security-user-list,
.login-event-list {
  display: grid;
  gap: 8px;
}

.security-user-rows {
  display: grid;
  gap: 8px;
}

.security-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid #d8e4ef;
  border-radius: 12px;
  background: #fff;
  text-align: left;
}

.security-user-row.selected {
  border-color: var(--blue);
  background: #eef6ff;
  box-shadow: inset 4px 0 0 var(--blue);
}

.security-user-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.security-user-main strong {
  color: var(--ink);
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-user-main span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #c9d9e8;
  border-radius: 14px;
  background: #fff;
}

.security-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.security-editor-head strong {
  color: var(--blue);
  font-size: 18px;
}

.security-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.security-badge {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 800;
}

.security-badge.off {
  color: var(--red);
  background: #fff0ee;
}

.security-editor-grid,
.security-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.security-editor-grid label,
.security-form-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.security-editor-grid input,
.security-editor-grid select,
.security-form-grid input,
.security-form-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
}

.security-editor-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.security-danger-zone {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid #ffd4cd;
  border-radius: 12px;
  background: #fff7f5;
}

.security-danger-zone strong {
  color: var(--red);
}

.security-danger-zone p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.security-danger-zone button {
  background: #b42318;
}

.security-danger-zone button:disabled {
  opacity: .45;
}

.security-message {
  min-height: 20px;
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.login-event {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
}

.login-event.failed {
  background: #fff5f3;
}

.login-event strong {
  color: var(--ink);
}

.login-event span,
.login-event small {
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 760px) {
  main {
    max-width: 1040px;
    margin: 0 auto;
  }

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

}

@media (max-width: 430px) {
  .header-actions {
    max-width: 178px;
  }

  .ghost {
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
  }

  .detail-metrics,
  .owner-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .supplier-card {
    padding: 12px 0 0;
  }

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

  .owner-edit-grid {
    grid-template-columns: 1fr;
  }

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

  .security-editor-grid,
  .security-form-grid {
    grid-template-columns: 1fr;
  }

  .security-user-row,
  .security-editor-head,
  .security-danger-zone,
  .security-title,
  .security-log-tools,
  .login-event {
    grid-template-columns: 1fr;
  }

  .security-log-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .security-editor-actions {
    grid-template-columns: 1fr;
  }

  .supplier-table-head {
    display: none;
  }

  .supplier-row {
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 10px 0;
  }

  .supplier-row .supplier-name {
    font-weight: 700;
  }

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

  .supplier-row span:nth-child(3),
  .supplier-row span:nth-child(4),
  .supplier-row span:nth-child(5) {
    color: #667085;
    font-size: 12px;
  }

  .supplier-row span:nth-child(3)::before {
    content: "进货 ";
  }

  .supplier-row span:nth-child(4)::before {
    content: "采购 ";
  }

  .supplier-row span:nth-child(5) {
    grid-column: 1 / -1;
  }

  .supplier-row span:nth-child(5)::before {
    content: "编号 ";
  }

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

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

  .stock-source-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

/* 骨架屏：列表加载占位 */
.skeleton-card {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.skeleton-thumb,
.skeleton-line {
  border-radius: 12px;
  background: linear-gradient(90deg, #eceff3 25%, #f7f9fb 50%, #eceff3 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-thumb {
  width: 86px;
  height: 86px;
}

.skeleton-lines {
  display: grid;
  gap: 8px;
  align-content: start;
  padding-top: 4px;
}

.skeleton-line {
  height: 14px;
  border-radius: 7px;
}

.skeleton-line.short {
  width: 55%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* 列表加载失败：内联提示 + 重试 */
.load-error {
  display: grid;
  gap: 10px;
  padding: 18px 14px;
  border: 1px solid #f0c9c4;
  border-radius: 14px;
  background: #fdf3f2;
  text-align: center;
}

.load-error p {
  margin: 0;
  color: #b42318;
  font-size: 14px;
  line-height: 1.5;
}

.load-error button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 800;
  background: var(--blue);
}

/* 详情页表单消息（保存失败等内联提示） */
.form-message {
  margin: 10px 0 0;
  color: #b42318;
  font-size: 14px;
  line-height: 1.5;
}

.form-message:empty {
  display: none;
}

/* 客户售价提醒：全部客户视图 */
.customer-all-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 1fr 0.6fr;
  gap: 6px;
  padding: 8px 6px;
  border-bottom: 1px solid #f0f2f5;
  font-size: 13px;
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
}

.customer-all-row:hover {
  background: var(--blue-soft);
}

.customer-all-row.customer-all-head {
  font-size: 11px;
  color: var(--muted);
  cursor: default;
  border-bottom: 1px solid var(--line);
}

.customer-all-row.customer-all-head:hover {
  background: none;
}

.customer-all-row .c-name {
  font-weight: 700;
}

.customer-all-row .c-price {
  color: var(--blue);
  font-weight: 700;
}

.customer-all-row .c-meta {
  color: var(--muted);
  font-size: 12px;
}

.customer-all-expand {
  min-height: 36px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.customer-back-all {
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

.customer-all-rows {
  display: grid;
  gap: 0;
}

/* 详情页主图切换 */
.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 36px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.photo-nav:active {
  background: rgba(15, 23, 42, 0.55);
}

.photo-prev { left: 8px; }
.photo-next { right: 8px; }

.photo-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.35);
}

.photo-dots i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

.photo-dots i.active {
  background: #fff;
  width: 14px;
}

/* .photo-nav/.photo-dots 在 .hidden 之后定义且特异性相同，会盖掉 .hidden；
   用双类选择器恢复“单图时隐藏箭头和圆点”的行为 */
.photo-nav.hidden,
.photo-dots.hidden {
  display: none;
}

/* 管家婆老档案搜索区 */
.archive-section {
  margin-top: 10px;
}
.archive-toggle {
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.archive-head {
  margin: 6px 2px;
  font-size: 13px;
  color: var(--muted);
}
.archive-body {
  margin-top: 6px;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.archive-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}
.archive-row + .archive-row {
  border-top: 1px dashed var(--line);
}
.archive-name {
  color: var(--ink);
  font-weight: 600;
}
.archive-spec {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}
.archive-facts {
  display: flex;
  gap: 10px;
  white-space: nowrap;
  font-size: 12px;
}
.archive-has-stock {
  color: var(--blue);
  font-weight: 600;
}
.archive-more {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}

