/* 内部比价系统 · 对齐线上看板排版 */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", -apple-system, "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1a1a1a;
  line-height: 1.5;
}

a { color: #ff6b3d; text-decoration: none; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 { margin: 0; font-size: 17px; font-weight: 700; }
.app-header__user { font-size: 12px; color: #888; }
.app-header__actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-block;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.btn-primary { background: #ff6b3d; color: #fff; }
.btn-ghost { background: #f0f0f0; color: #555; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 32px;
}

.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 12px;
  color: #666;
  background: #fff8f5;
  border: 1px solid #ffe4d6;
  border-radius: 8px;
}

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

.stat {
  padding: 12px 8px;
  text-align: center;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.stat__num { display: block; font-size: 22px; font-weight: 700; color: #1a1a1a; }
.stat__num--warn { color: #e53935; }
.stat__num--good { color: #2e7d32; }
.stat__label { font-size: 11px; color: #888; }

.stat--clickable {
  width: 100%;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.stat--clickable:disabled {
  opacity: 0.5;
  cursor: default;
}

.stat--clickable:not(:disabled):active {
  transform: scale(0.98);
}

.stat--clickable.is-active {
  border-color: #ffcdd2;
  background: #fffbfb;
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.12);
}

#statTotalBtn.is-active {
  border-color: #dbeafe;
  background: #f3f8ff;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.12);
}

#statTotalBtn.is-active .stat__num {
  color: #1565c0;
}

.item-card {
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.item-card.is-alert {
  border: 1px solid #ffcdd2;
  background: #fffbfb;
}

.item-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.item-card__code { font-size: 11px; color: #999; }

.item-card__name {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.item-card__badge {
  flex-shrink: 0;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
}

.badge--up { color: #c62828; background: #ffebee; }
.badge--down { color: #2e7d32; background: #e8f5e9; }
.badge--flat { color: #666; background: #f0f0f0; }

.item-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.meta-tag {
  padding: 3px 8px;
  font-size: 11px;
  color: #666;
  background: #f5f5f5;
  border-radius: 4px;
}

/* 价格对比：左参考价（黑）右市场（橙） */
.price-compare {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

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

.price-box {
  display: flex;
  flex-direction: column;
  padding: 10px 6px;
  border-radius: 10px;
  background: #fafafa;
  min-height: 72px;
  min-width: 0;
}

.price-compare--3 .price-box {
  padding: 8px 4px;
  min-height: 66px;
}

.price-box--market {
  background: #fff8f4;
  border: 1px solid #ffe0cc;
}

.price-box__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 22px;
  margin-bottom: 4px;
}

.price-box__top .price-box__label {
  flex: 1;
  min-width: 0;
}

.price-box__label {
  font-size: 11px;
  color: #888;
  line-height: 1.3;
  margin: 0;
}

.price-box__value-wrap {
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.price-box__sub {
  display: block;
  font-size: 9px;
  color: #aaa;
  margin-bottom: 4px;
  line-height: 1.2;
}

.price-box__value {
  display: inline;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
}

.price-compare--3 .price-box__value {
  font-size: 13px;
}

.price-box__unit {
  font-size: 11px;
  font-weight: 400;
  color: #888;
}

.price-compare--3 .price-box__unit {
  font-size: 10px;
}

.price-compare--3 .price-box__label {
  font-size: 10px;
}

.price-box--market .price-box__value,
.price-box__value--pending {
  color: #ff6b3d;
}

.price-entry-link {
  flex-shrink: 0;
  margin-left: auto;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #ff6b3d;
  background: #fff3ee;
  border-radius: 4px;
  border: 1px solid #ffd4c4;
  white-space: nowrap;
  line-height: 1.2;
  text-decoration: none;
}

.market-source {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  color: #555;
  background: #f9f9f9;
  border-radius: 8px;
}

.market-source.is-warn {
  color: #c62828;
  background: #ffebee;
}

.market-source.is-good {
  color: #2e7d32;
  background: #e8f5e9;
}

.market-source__meta {
  display: block;
  color: #666;
  line-height: 1.5;
}

.market-source__verdict {
  display: block;
  margin-top: 4px;
  font-weight: 600;
  line-height: 1.45;
}

.market-source__verdict.is-warn {
  color: #c62828;
}

.market-source__verdict.is-good {
  color: #2e7d32;
}

.market-source__verdict.is-flat {
  color: #666;
}

.form-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, #fff8f4 0%, #ffe8dc 100%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 28px 22px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(255,130,80,0.15);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  text-align: center;
}

.login-card p {
  margin: 0 0 20px;
  font-size: 13px;
  color: #888;
  text-align: center;
}

.error-msg {
  margin-bottom: 12px;
  padding: 8px 10px;
  font-size: 13px;
  color: #c62828;
  background: #ffebee;
  border-radius: 8px;
  display: none;
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

.footer-note {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: #aaa;
}

.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 16px;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

.cat-card--disabled,
.cat-card:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.cat-card__name { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.cat-card__count { font-size: 14px; font-weight: 600; color: #ff6b3d; margin-bottom: 4px; }
.cat-card__desc { font-size: 11px; color: #999; }

/* 采购员工作台 */
.purchaser-hero {
  padding: 24px 18px;
  margin-bottom: 16px;
  text-align: center;
  background: linear-gradient(180deg, #fff8f4 0%, #fff 100%);
  border: 1px solid #ffe4d6;
  border-radius: 14px;
}

.purchaser-hero__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.purchaser-hero__desc {
  margin: 0 0 18px;
  font-size: 13px;
  color: #888;
}

.purchaser-hero__btn {
  display: inline-block;
  min-width: 160px;
  padding: 12px 24px;
  font-size: 16px;
}

.purchaser-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.purchaser-cat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
  padding: 14px 14px;
  font-family: inherit;
  text-align: left;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: pointer;
}

.purchaser-cat-row__name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

.purchaser-cat-row__meta {
  font-size: 12px;
  color: #ff6b3d;
}

.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.user-row:last-child {
  border-bottom: none;
}

.user-toggle-btn {
  flex-shrink: 0;
}

.admin-subtitle {
  margin: 16px 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.role-perms {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.role-perm {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.role-perm strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.role-perm span {
  color: #666;
}

.role-perm--admin { background: #fff3ee; border: 1px solid #ffd4c4; }
.role-perm--purchaser { background: #f3f8ff; border: 1px solid #dbeafe; }
.role-perm--merchant { background: #f5f5f5; border: 1px solid #e8e8e8; }

.role-hint {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 12px;
  color: #666;
  background: #fafafa;
  border-radius: 8px;
  line-height: 1.5;
}

.user-group {
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.user-group:last-child {
  border-bottom: none;
}

.user-group__title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #ff6b3d;
}

.user-row__meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #888;
}

.user-status--on { color: #2e7d32; }
.user-status--off { color: #999; }

.btn-back {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 0;
  font-size: 14px;
  font-family: inherit;
  color: #ff6b3d;
  background: none;
  border: none;
  cursor: pointer;
}

.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  color: #888;
}
