/* 嘉楠系统 - 样式 */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #f7f8fb;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { cursor: pointer; border: 0; background: transparent; font-family: inherit; font-size: inherit; color: inherit; }
input, textarea, select { font-family: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}
.site-name { font-size: 16px; font-weight: 700; color: #111827; }
.site-desc { font-size: 12px; color: #6b7280; }

.nav-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-tabs button {
  padding: 8px 14px;
  border-radius: 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.nav-tabs button:hover { background: #f3f4f6; }
.nav-tabs button.active,
.nav-tabs button[data-active="true"] {
  background: #4f46e5;
  color: #fff;
}

.auth-area { display: flex; align-items: center; gap: 8px; }
.btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 0;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-ghost { background: transparent; color: #4f46e5; }
.btn-ghost:hover { background: #eef2ff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #374151;
}
#user-name { color: #111827; font-weight: 500; }

.mobile-tabs {
  display: none;
  border-top: 1px solid #e5e7eb;
  overflow-x: auto;
  white-space: nowrap;
  padding: 8px 16px;
  gap: 6px;
}
.mobile-tabs button {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .nav-tabs, .auth-area { display: none; }
  .mobile-tabs { display: flex; }
}

/* Content */
#app { padding: 24px 16px; }
#app h1 { font-size: 22px; font-weight: 700; margin: 0 0 20px; color: #111827; }
#app h2 { font-size: 20px; font-weight: 700; margin: 0 0 16px; color: #111827; }
#app h3 { font-size: 16px; font-weight: 700; margin: 0 0 12px; color: #111827; }

/* Hero/首页 */
.hero {
  background: linear-gradient(135deg, #6366f1, #9333ea);
  color: #fff;
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.hero h1 { color: #fff; font-size: 26px; margin: 0 0 8px; }
.hero-desc { opacity: 0.9; margin: 0 0 16px; font-size: 14px; }
.hero-announce {
  background: rgba(255,255,255,0.15);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}
.hero-contact { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; }

/* 商品网格 */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title .text-link {
  color: #4f46e5;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.grid-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.product-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: box-shadow 0.15s;
  cursor: pointer;
}
.product-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
.product-card .product-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #f3f4f6;
}
.product-card .product-image-fallback {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #818cf8, #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}
.product-card .product-body { padding: 16px; }
.product-card .product-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.product-card .product-name {
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
  line-height: 1.4;
}
.product-card .product-price {
  color: #ef4444;
  font-weight: 700;
  white-space: nowrap;
}
.product-card .product-desc {
  color: #6b7280;
  font-size: 13px;
  height: 40px;
  overflow: hidden;
  line-height: 1.5;
}
.product-card .product-btn {
  margin-top: 12px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

/* 表单/卡片 */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 14px;
  color: #374151;
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #111827;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.field textarea { resize: vertical; min-height: 90px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.btn-primary-lg {
  padding: 12px;
  border-radius: 8px;
  background: #4f46e5;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.btn-primary-lg:hover { background: #4338ca; }

/* OAuth 按钮 */
.btn-oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}
.btn-oauth:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.btn-oauth:active {
  transform: translateY(0);
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #4f46e5;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: none;
  z-index: 100;
  max-width: 90%;
}
.toast.show { display: inline-block; }

/* 登录/注册 */
.auth-form-wrap { max-width: 420px; margin: 24px auto; }
.auth-form-wrap .alt-link { text-align: center; font-size: 14px; color: #6b7280; }
.auth-form-wrap .alt-link button { color: #4f46e5; background: none; border: none; cursor: pointer; padding: 0; font-size: 14px; }
.auth-hint {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  background: #f9fafb;
  padding: 10px;
  border-radius: 8px;
}

/* 工单 */
.ticket-list { display: flex; flex-direction: column; gap: 12px; }
.ticket-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  cursor: pointer;
}
.ticket-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.ticket-item-title { font-weight: 600; color: #1f2937; font-size: 14px; }
.ticket-item-body { color: #6b7280; font-size: 14px; margin-bottom: 8px; }
.ticket-item-meta { font-size: 12px; color: #9ca3af; }

.ticket-notice {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #4338ca;
  margin-bottom: 16px;
}

.messages { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.msg {
  border-radius: 12px;
  padding: 12px 16px;
  max-width: 85%;
}
.msg-admin {
  background: #eef2ff;
  margin-left: auto;
}
.msg-user {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.msg-meta { font-size: 12px; color: #6366f1; margin-bottom: 4px; }
.msg-user .msg-meta { color: #6b7280; }
.msg-content { color: #1f2937; font-size: 14px; white-space: pre-wrap; line-height: 1.6; }

.ticket-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  resize: vertical;
  font-size: 14px;
}

/* 订单详情 */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  font-size: 14px;
}
.info-grid .field-label { color: #6b7280; margin-bottom: 4px; }
.info-grid .field-value { color: #1f2937; font-weight: 500; }
.info-grid .field-value.price { color: #ef4444; font-weight: 700; font-size: 16px; }
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; } }

/* 个人中心 */
.profile-head {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 32px;
  text-align: center;
}
.avatar-lg {
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}
.profile-head .nickname { font-size: 18px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.profile-head .sub { color: #6b7280; font-size: 14px; margin-bottom: 8px; }
.badge-admin {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 12px;
  margin-top: 8px;
}

/* 后台管理 */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.admin-tabs button {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  background: transparent;
  border: none;
  cursor: pointer;
}
.admin-tabs button.active { background: #4f46e5; color: #fff; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 24px;
}
.stat-label { color: #6b7280; font-size: 14px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: #6366f1; }

/* 表格 */
.table {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: auto;
}
.table table {
  width: 100%;
  font-size: 14px;
  border-collapse: collapse;
  min-width: 720px;
}
.table thead {
  background: #f9fafb;
  color: #4b5563;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.table th { font-weight: 600; font-size: 13px; color: #4b5563; }
.table tr:last-child td { border-bottom: 0; }

.text-link {
  color: #4f46e5;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  margin-right: 12px;
}
.text-danger {
  color: #dc2626;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-open { background: #dbeafe; color: #1e40af; }
.badge-closed { background: #e5e7eb; color: #374151; }

.status-select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

/* 轮播图 */
.carousel {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.carousel img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}
.carousel-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}
.carousel-controls button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  border: none;
  cursor: pointer;
  font-size: 16px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.45);
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; color: #1f2937; }
.modal-close {
  color: #9ca3af;
  font-size: 18px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
}
.modal-footer button {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: none;
}
.modal-footer .btn-cancel { border: 1px solid #d1d5db; color: #374151; background: #fff; }
.modal-footer .btn-submit { background: #4f46e5; color: #fff; }

/* banner卡片 */
.banners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.banner-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;
}
.banner-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.banner-card .banner-img-fallback {
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #818cf8, #a855f7);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.banner-card .banner-body { padding: 16px; }
.banner-card .banner-title { font-weight: 600; color: #1f2937; font-size: 14px; margin-bottom: 6px; }
.banner-card .banner-meta { color: #6b7280; font-size: 12px; margin-bottom: 4px; }
.banner-card .banner-actions { display: flex; gap: 8px; margin-top: 8px; }
.banner-card .banner-actions button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: none;
}
.banner-card .btn-edit { background: #eef2ff; color: #4f46e5; }
.banner-card .btn-del { background: #fee2e2; color: #dc2626; }

/* empty/text-center helpers */
.empty {
  background: #fff;
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}
.text-muted { color: #6b7280; }
.text-small { font-size: 12px; color: #9ca3af; }
