/* ============== 全局样式 ============== */
:root {
  --primary: #ff4757;
  --primary-dark: #e8414e;
  --primary-light: #ffe5e8;
  --accent: #ff6b81;
  --text: #2f3542;
  --text-light: #747d8c;
  --bg: #f7f8fc;
  --bg-soft: #ffffff;
  --border: #eef0f5;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.08);
  --radius: 10px;
  --radius-lg: 16px;
  --gradient: linear-gradient(135deg, #ff6b81 0%, #ff4757 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

::selection { background: var(--primary-light); color: var(--primary-dark); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ============== 顶部导航 ============== */
.topbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  height: 68px;
  gap: 24px;
}
.logo {
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
}
.nav a {
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  white-space: nowrap;
}
.nav a svg { transition: transform .2s; }
.nav a:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.nav a:hover svg { transform: scale(1.1); }
.nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}
.nav a.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
}

.nav .hi {
  color: var(--text-light);
  font-size: 13px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-hi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f1f3f8;
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.nav-hi svg { color: var(--text-light); }

.btn-mini {
  background: #f1f3f8;
  color: var(--text-light);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  transition: all .2s;
}
.btn-mini:hover { background: var(--primary-light); color: var(--primary); }

/* 购物车链接 + 角标 */
.nav-cart-link { position: relative; }
.nav-cart-link svg { stroke-width: 2.2; }
.nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 999px;
  border: 2px solid #fff;
  box-sizing: content-box;
  transform: scale(0);
  transition: transform .25s cubic-bezier(.5,1.6,.4,1);
}
.nav-badge:not(.nav-badge-zero) { transform: scale(1); }
@keyframes navBadgePop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.nav-badge.bump { animation: navBadgePop .35s ease; }

/* 登录/注册按钮 */
.nav-login {
  color: var(--text) !important;
}
.nav-register {
  background: var(--gradient) !important;
  color: #fff !important;
  padding: 8px 20px !important;
  box-shadow: 0 4px 10px rgba(255, 71, 87, 0.25);
}
.nav-register:hover {
  color: #fff !important;
  background: var(--primary-dark) !important;
  transform: translateY(-1px);
}
.nav-register svg { display: none; }

/* 退出登录按钮 - 明显化 */
.nav-logout {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%) !important;
  color: #fff !important;
  padding: 8px 18px !important;
  border-radius: 8px !important;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(238, 82, 83, 0.25);
  letter-spacing: 0.5px;
}
.nav-logout:hover {
  background: linear-gradient(135deg, #ee5253 0%, #d63031 100%) !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(238, 82, 83, 0.35);
}
.nav-logout:active { transform: translateY(0); }

/* ============== 主体与底部 ============== */
main.wrap { min-height: calc(100vh - 200px); padding: 28px 20px 40px; }

.footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  margin-top: 40px;
}
.footer a { color: var(--text-light); margin: 0 8px; }
.footer a:hover { color: var(--primary); }

/* ============== 首页 Hero ============== */
.hero {
  position: relative;
  background: var(--gradient);
  color: #fff;
  padding: 64px 40px;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(255, 71, 87, 0.18);
}
.hero::before {
  content: "";
  position: absolute;
  top: -80px; right: -80px;
  width: 280px; height: 280px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -100px; left: 30%;
  width: 220px; height: 220px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}
.hero h1 {
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: 1px;
  position: relative;
}
.hero p {
  font-size: 16px;
  opacity: 0.92;
  position: relative;
}
.hero .hero-cta {
  margin-top: 24px;
  display: inline-block;
  background: #fff;
  color: var(--primary);
  padding: 12px 28px;
  border-radius: 999px;
  font-weight: 600;
  position: relative;
  transition: transform .2s;
}
.hero .hero-cta:hover { transform: translateY(-2px); color: var(--primary-dark); }

/* ============== 区块标题 ============== */
.sec-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sec-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--gradient);
  border-radius: 2px;
}

/* ============== 商品卡片网格 ============== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.card {
  background: var(--bg-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .25s, box-shadow .25s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.card .img {
  width: 100%;
  aspect-ratio: 1/1;
  background: #fafbfd;
  object-fit: cover;
  transition: transform .4s;
}
.card:hover .img { transform: scale(1.04); }
.card .img-wrap { overflow: hidden; }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card .name {
  font-size: 14px;
  color: var(--text);
  height: 44px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}
.card .price {
  color: var(--primary);
  font-weight: 700;
  font-size: 20px;
  margin: 8px 0 12px;
}
.card .btn {
  margin-top: auto;
  text-align: center;
  background: var(--gradient);
  color: #fff;
  padding: 9px 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
  box-shadow: 0 4px 10px rgba(255, 71, 87, 0.2);
}
.card .btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255, 71, 87, 0.3); }

/* ============== 通用按钮 ============== */
.btn {
  display: inline-block;
  padding: 9px 20px;
  background: var(--gradient);
  color: #fff;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  box-shadow: 0 4px 10px rgba(255, 71, 87, 0.18);
}
.btn:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 71, 87, 0.28);
}
.btn:active { transform: translateY(0); }
.btn.gray {
  background: #ced6e0;
  box-shadow: none;
}
.btn.gray:hover { background: #a4b0be; color: #fff; }
.btn.danger { background: linear-gradient(135deg, #ff6b6b, #ee5253); }
.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  box-shadow: none;
}
.btn-outline:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: none;
}
.btn-lg { padding: 12px 32px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

/* ============== 表单 ============== */
.form {
  background: #fff;
  padding: 32px 32px 28px;
  border-radius: var(--radius-lg);
  max-width: 440px;
  margin: 30px auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.form h2 {
  margin-bottom: 22px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #f7f8fc;
  color: var(--text);
  transition: all .2s;
  font-family: inherit;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.1);
}
.form-row textarea { height: 100px; resize: vertical; }
.form .btn { width: 100%; padding: 12px; font-size: 15px; }
.form .alt {
  text-align: center;
  font-size: 13px;
  color: var(--text-light);
  margin-top: 14px;
}
.form .alt a { font-weight: 500; }

/* ============== 表格 ============== */
.table {
  width: 100%;
  background: #fff;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.table th, .table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
.table th {
  background: #f7f8fc;
  font-weight: 600;
  color: var(--text-light);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }

/* ============== 商品详情 ============== */
.detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  background: #fff;
  padding: 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.detail .img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: var(--radius);
  background: #fafbfd;
}
.detail h1 { font-size: 26px; margin-bottom: 14px; line-height: 1.3; }
.detail .price {
  color: var(--primary);
  font-size: 34px;
  font-weight: 800;
  margin: 16px 0;
  letter-spacing: -0.5px;
}
.detail .merchant {
  background: #f7f8fc;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 14px;
  color: var(--text-light);
}
.detail .merchant strong { color: var(--text); }
.detail .desc {
  margin-top: 20px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.detail .actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.detail .qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.detail .qty button {
  width: 36px;
  height: 38px;
  border: 0;
  background: #f7f8fc;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  transition: background .2s;
}
.detail .qty button:hover { background: var(--primary-light); color: var(--primary); }
.detail .qty input {
  width: 56px;
  height: 38px;
  text-align: center;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}

/* ============== 提示与标签 ============== */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 4px solid;
}
.alert.ok {
  background: #e8f9ee;
  color: #2dbe60;
  border-color: #2dbe60;
}
.alert.err {
  background: #ffeaea;
  color: #ee5253;
  border-color: #ee5253;
}
.alert.info {
  background: #e3f2fd;
  color: #1e88e5;
  border-color: #1e88e5;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.tag.user { background: #e3f2fd; color: #1e88e5; }
.tag.merchant { background: #fff3e0; color: #f57c00; }
.tag.admin { background: #f3e5f5; color: #8e24aa; }
.tag.on { background: #e8f9ee; color: #2dbe60; }
.tag.off { background: #f1f3f8; color: var(--text-light); }
.tag.pending { background: #fff8e1; color: #f57f17; }
.tag.approved { background: #e8f9ee; color: #2dbe60; }
.tag.rejected { background: #ffeaea; color: #ee5253; }

/* ============== 购物车 ============== */
.cart-table .qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cart-table .qty input {
  width: 54px;
  text-align: center;
  padding: 6px;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}
.cart-table .qty button {
  width: 30px;
  height: 32px;
  border: 0;
  background: #f7f8fc;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  transition: all .2s;
}
.cart-table .qty button:hover { background: var(--primary-light); color: var(--primary); }

.cart-summary {
  background: #fff;
  padding: 22px 26px;
  border-radius: var(--radius);
  margin-top: 20px;
  text-align: right;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.cart-summary .label { color: var(--text-light); font-size: 14px; }
.cart-summary .total {
  font-size: 28px;
  color: var(--primary);
  font-weight: 800;
  margin-left: 12px;
  letter-spacing: -0.5px;
}
.cart-summary .btn { margin-left: 20px; }

/* ============== 商品列表页筛选/搜索 ============== */
.toolbar {
  background: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar form { display: flex; gap: 10px; flex: 1; }
.toolbar input[type="text"] {
  flex: 1;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #f7f8fc;
  min-width: 0;
}
.toolbar input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.1);
}

/* ============== 空状态 ============== */
.empty {
  background: #fff;
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--text-light);
  border: 1px dashed var(--border);
}
.empty .icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ============== 后台 ============== */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: #f0f2f7;
}
.admin-side {
  background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
  color: #fff;
  padding: 22px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-side h2 {
  text-align: center;
  padding: 0 20px 18px;
  border-bottom: 1px solid #455;
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 16px 18px;
}
.admin-side a {
  display: block;
  color: #cfd8dc;
  padding: 12px 22px;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all .2s;
}
.admin-side a:hover,
.admin-side a.active {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-left-color: var(--primary);
}
.admin-main { padding: 24px; }
.admin-top {
  background: #fff;
  padding: 16px 22px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}
.admin-card {
  background: #fff;
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pagination {
  margin: 20px 0;
  text-align: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: inline-block;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  transition: all .2s;
  min-width: 36px;
  text-align: center;
}
.pagination a:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.pagination .current {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(255, 71, 87, 0.2);
}

/* ============== 统计卡片 ============== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--gradient);
}
.stat-card .label {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
}

/* ============== 响应式 ============== */
@media (max-width: 768px) {
  .topbar .wrap { height: 60px; gap: 8px; }
  .nav { gap: 2px; }
  .nav a { padding: 6px 8px; font-size: 12px; }
  .nav a span { display: none; }
  .nav a svg { display: inline-block; }
  .nav-register { display: inline-flex !important; padding: 6px 12px !important; }
  .nav-hi { padding: 6px 8px; }
  .nav-hi span { display: inline; font-size: 12px; }
  .nav-logout { padding: 8px !important; }
  .nav-logout span { display: none; }
  .hero { padding: 40px 24px; }
  .hero h1 { font-size: 24px; }
  .detail { grid-template-columns: 1fr; padding: 20px; gap: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card .name { font-size: 13px; height: 40px; }
  .card .price { font-size: 17px; }
  .form { margin: 20px 12px; padding: 24px 20px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; }
}

/* ============== 动画 ============== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.card, .form, .detail, .admin-card { animation: fadeIn .4s ease; }

/* ============== 商品介绍区（前台底部） ============== */
.detail-intro {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px 36px;
  margin-top: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.detail-intro .sec-title { margin: 0 0 18px; }
.detail-intro-body {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  word-break: break-word;
}
.detail-intro-body p { margin: 0 0 12px; }
.detail-intro-body h1,
.detail-intro-body h2,
.detail-intro-body h3,
.detail-intro-body h4 {
  margin: 22px 0 12px;
  font-weight: 700;
  color: var(--text);
}
.detail-intro-body h1 { font-size: 22px; }
.detail-intro-body h2 { font-size: 19px; }
.detail-intro-body h3 { font-size: 17px; }
.detail-intro-body ul,
.detail-intro-body ol {
  padding-left: 24px;
  margin: 0 0 14px;
}
.detail-intro-body li { margin-bottom: 4px; }
.detail-intro-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 8px 0;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.detail-intro-body a {
  color: var(--primary);
  text-decoration: underline;
}
.detail-intro-body blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  margin: 12px 0;
  padding: 10px 16px;
  border-radius: 0 6px 6px 0;
  color: var(--text);
}
.detail-intro-body .muted,
.muted { color: var(--text-light); text-align: center; padding: 20px 0; }

/* ============== 富文本编辑器 ============== */
.rt-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.rt-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.08);
}
.rt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  background: #f7f8fc;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
}
.rt-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rt-btn:hover {
  background: #fff;
  border-color: var(--border);
  color: var(--primary);
}
.rt-btn:active { transform: scale(0.96); }
.rt-sep {
  width: 1px;
  background: var(--border);
  margin: 4px 4px;
  align-self: stretch;
}
.rt-content {
  min-height: 220px;
  padding: 14px 16px;
  outline: none;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: #fff;
}
.rt-content:empty::before {
  content: attr(data-placeholder);
  color: #a4b0be;
  pointer-events: none;
}
.rt-content h1, .rt-content h2, .rt-content h3 { margin: 14px 0 8px; }
.rt-content p { margin: 0 0 10px; }
.rt-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 6px 0;
  display: block;
}
.rt-content ul, .rt-content ol { padding-left: 24px; margin: 0 0 10px; }
.rt-content blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
  margin: 10px 0;
  padding: 6px 12px;
  border-radius: 0 6px 6px 0;
}
.rt-content a { color: var(--primary); text-decoration: underline; }

/* ============== .rt-editor（同 .rt-content 样式，给 merchant/products.php 用）============== */
.rt-editor {
  min-height: 220px;
  padding: 14px 16px;
  outline: none;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: #fff;
  border-radius: 0 0 8px 8px;
  word-break: break-word;
}
.rt-editor:empty::before {
  content: attr(data-placeholder);
  color: #a4b0be;
  pointer-events: none;
}
.rt-editor h1, .rt-editor h2, .rt-editor h3 { margin: 14px 0 8px; }
.rt-editor p { margin: 0 0 10px; }
.rt-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 6px 0;
  display: block;
}
.rt-editor ul, .rt-editor ol { padding-left: 24px; margin: 0 0 10px; }
.rt-editor blockquote {
  border-left: 3px solid var(--primary);
  background: var(--primary-light);
  margin: 10px 0;
  padding: 6px 12px;
  border-radius: 0 6px 6px 0;
}
.rt-editor a { color: var(--primary); text-decoration: underline; }

/* ============== Modal 弹窗 ============== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: maskIn .2s ease;
}
.modal-mask[hidden] { display: none; }
@keyframes maskIn { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  width: 92%;
  max-width: 440px;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modalIn .25s cubic-bezier(.22,1.4,.36,1);
}
.modal-md { max-width: 480px; }
.modal-sm { max-width: 380px; }
@keyframes modalIn {
  from { transform: translateY(20px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfd, #fff);
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  width: 30px; height: 30px;
  border-radius: 50%;
  color: var(--text-light);
  cursor: pointer;
  transition: all .15s;
}
.modal-close:hover { background: var(--primary-light); color: var(--primary); }

.modal-body {
  padding: 22px;
  overflow: auto;
}
.modal-body .form-row { margin-bottom: 14px; }
.modal-body .form-row:last-child { margin-bottom: 0; }
.modal-body .form-row label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 6px;
}
.modal-body input[type=text],
.modal-body input[type=tel],
.modal-body textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.modal-body input:focus,
.modal-body textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 71, 87, .08);
}
.modal-body textarea { resize: vertical; min-height: 64px; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: #fafbfd;
  margin: 0;
}
.modal-foot .btn { margin: 0; }

/* 付款二维码 */
.pay-body { padding: 22px 22px 8px; text-align: center; }
.pay-amount { margin-bottom: 14px; }
.pay-amount small { color: var(--text-light); font-size: 12px; }
.pay-amount .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
  letter-spacing: -.5px;
}
.pay-qr {
  width: 240px; height: 240px;
  margin: 0 auto 12px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.pay-qr img { width: 100%; height: 100%; object-fit: contain; }
.pay-no {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
  word-break: break-all;
}
.pay-tips {
  text-align: left;
  background: #fff8e1;
  color: #8a6d3b;
  border-radius: 8px;
  padding: 10px 14px 10px 28px;
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.7;
  list-style: disc;
}
.pay-tips li { margin: 2px 0; }
.pay-body .modal-foot { border-top: 1px solid var(--border); }

/* ============== 商家入驻表单 fieldset ============== */
.form-fs {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px 6px;
  margin: 0 0 18px;
  background: #fafbfd;
}
.form-fs legend {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding: 0 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3px 12px;
}
.form-fs .form-row { margin-bottom: 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ============== 商家中心 ============== */
.merchant-shop {
  padding: 10px 14px 14px;
  margin: 6px 12px 14px;
  background: linear-gradient(135deg, var(--primary-light), #fff);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.merchant-shop .name { font-weight: 700; font-size: 14px; color: var(--text); }
.merchant-shop .sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.merchant-side-bottom {
  position: absolute;
  bottom: 16px; left: 12px; right: 12px;
  display: flex; flex-direction: column;
  gap: 4px;
}
.merchant-side-bottom a {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-light);
  text-decoration: none;
  border-radius: 4px;
}
.merchant-side-bottom a:hover { background: var(--primary-light); color: var(--primary); }
.merchant-side-bottom a.danger { color: #e74c3c; }
.merchant-side-bottom a.danger:hover { background: #ffeaea; }

.merchant-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.merchant-stats .stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 16px 18px;
  text-align: center;
  transition: transform .15s, box-shadow .15s;
}
.merchant-stats .stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.merchant-stats .stat-card.ok   { border-left-color: #2ecc71; }
.merchant-stats .stat-card.gray { border-left-color: #95a5a6; }
.merchant-stats .stat-card.warn { border-left-color: #f39c12; }
.merchant-stats .num { font-size: 26px; font-weight: 800; color: var(--text); }
.merchant-stats .lab { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.table.info th, .table.info td { background: transparent; }
.table.info th { width: 100px; color: var(--text-light); font-weight: 600; }

/* 导航上的商家按钮（已审核） */
.nav-merchant {
  background: linear-gradient(135deg, var(--primary), #ff6b81);
  color: #fff !important;
  border-radius: 20px;
  padding: 6px 14px;
  margin-left: 4px;
}
.nav-merchant:hover { filter: brightness(1.05); }
.nav-merchant-pending { color: #999; padding: 6px 14px; }
.nav-apply, .nav-merchant-login {
  border: 1px dashed var(--primary);
  color: var(--primary) !important;
  border-radius: 20px;
  padding: 6px 14px;
  margin-left: 4px;
  background: var(--primary-light);
}
.nav-apply:hover, .nav-merchant-login:hover {
  background: var(--primary);
  color: #fff !important;
}

/* ============== 注册页：协议勾选 ============== */
.form-agree {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--text-light);
  margin: 4px 0 16px;
  padding: 10px 12px;
  background: #fafbfd;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.form-agree input[type=checkbox] {
  width: 16px;
  height: 16px;
  margin-right: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}
.form-agree a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.form-agree a:hover { border-color: var(--primary); }

/* ============== 法律页面 ============== */
.legal-doc {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 40px 36px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  max-width: 880px;
  margin: 24px auto;
  line-height: 1.85;
  color: var(--text);
}
.legal-meta {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.legal-tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.legal-h1 {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  margin: 8px 0 24px;
  letter-spacing: 1px;
  position: relative;
  padding-bottom: 18px;
}
.legal-h1::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 3px;
  background: linear-gradient(90deg, var(--primary), #ff6b81);
  border-radius: 2px;
}
.legal-lead {
  background: #fff8e1;
  color: #8a6d3b;
  border-left: 3px solid #f39c12;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 14px;
  margin: 0 0 24px;
}
.legal-doc h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 10px;
  padding-left: 12px;
  border-left: 4px solid var(--primary);
  line-height: 1.4;
}
.legal-doc ol {
  padding-left: 24px;
  margin: 0 0 12px;
}
.legal-doc ol > li {
  margin-bottom: 6px;
}
.legal-doc ol ol,
.legal-doc ol ul {
  margin: 6px 0 4px;
  padding-left: 22px;
}
.legal-doc ul {
  list-style: disc;
  padding-left: 22px;
  margin: 6px 0;
}
.legal-doc p { margin: 0 0 10px; }
.legal-foot {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}
.legal-foot .btn { margin: 0; }
@media (max-width: 600px) {
  .legal-doc { padding: 22px 18px; }
  .legal-h1 { font-size: 22px; }
}
