/* 全局变量 */
:root {
  --ink: #0f172a;
  --muted: #64748b;
  --soft: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --orange: #f97316;
  --orange-soft: #fff7ed;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: #f7f8fa;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font: inherit;
  outline: none;
}

button {
  cursor: pointer;
  transition: all 0.15s ease;
}

button:active {
  transform: scale(0.97);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ========== 登录页面 ========== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 50%, #f0fdf4 100%);
  padding: 20px;
}

.login-box {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  object-fit: cover;
  display: block;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.login-logo p {
  font-size: 16px;
  color: var(--muted);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 16px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--soft);
  transition: border-color 0.2s, background 0.2s;
}

.form-group input:focus {
  border-color: var(--brand);
  background: #fff;
}

.captcha-row {
  display: flex;
  gap: 12px;
}

.captcha-row input {
  flex: 1;
}

.captcha-img {
  width: 100px;
  height: 46px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 4px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.login-btn {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  margin-top: 8px;
}

.login-btn:hover {
  opacity: 0.92;
}

/* ========== 主布局 ========== */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: #ffffff;
  border-bottom: 1px solid #ebedf0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.system-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-name {
  font-size: 15px;
  color: var(--muted);
}

.logout-btn {
  padding: 6px 14px;
  background: var(--soft);
  color: var(--muted);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
}

.logout-btn:hover {
  background: var(--line);
}

/* 内容区域 - 手机端居中，PC端限制最大宽度 */
.content-area {
  padding-top: 52px;
  padding-bottom: 84px;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  background: #f7f8fa;
}

.content-page {
  display: none;
}

.content-page.active {
  display: block;
}

/* ========== 导航栏 ========== */
.mp-navbar {
  height: 44px;
  background: #fff;
  border-bottom: 1px solid #ebedf0;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 16px;
}

.mp-navbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: #000;
}

.navbar-back {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 12px;
  z-index: 2;
  cursor: pointer;
  color: #000;
  background: transparent;
  border: none;
}

.navbar-back svg {
  width: 20px;
  height: 20px;
}

/* ========== 屏幕内容区 ========== */
.screen {
  padding: 12px 16px 100px;
  overflow-y: auto;
}

/* ========== 搜索行 ========== */
.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  box-shadow: var(--shadow-sm);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 8px;
}

.search-box input {
  flex: 1;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 16px;
}

.search-btn {
  flex-shrink: 0;
  padding: 0 16px;
  height: 40px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  align-self: center;
}

/* ========== 筛选行 ========== */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex: 0 0 auto;
  border: 0;
  color: var(--muted);
  background: var(--surface);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.filter-btn.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  font-weight: 600;
}

/* ========== 分段控件 ========== */
.segmented {
  display: flex;
  background: var(--soft);
  border-radius: 8px;
  padding: 2px;
  width: 180px;
}

.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 6px 0;
  font-size: 14px;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.seg-btn.active {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ========== 区块标题 ========== */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 20px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--muted);
}

/* ========== 卡片面板 ========== */
.card-panel {
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

/* ========== 列表 ========== */
.list {
  display: grid;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 4px 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

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

.list-row-content {
  flex: 1;
  min-width: 0;
}

.list-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-row-top strong {
  font-size: 16px;
  font-weight: 600;
}

.list-arrow {
  font-size: 16px;
  color: #94a3b8;
}

.list-row-sub {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ========== 门店列表 ========== */
.store-list {
  display: grid;
  gap: 10px;
}

.store-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.store-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.store-card-header strong {
  font-size: 16px;
  font-weight: 600;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
}

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

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

.pill.gray {
  background: #f1f5f9;
  color: #64748b;
}

.store-owner {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 12px;
}

.store-table-head {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  font-size: 13px;
  color: #94a3b8;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.store-table-head span:last-child {
  text-align: right;
}

.store-table-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  font-size: 15px;
  padding-top: 8px;
}

.store-table-row span:last-child {
  text-align: right;
  font-weight: 600;
}

.store-table-row .expired {
  color: var(--danger);
}

/* ========== 流水统计 ========== */
.revenue-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.revenue-card {
  flex: 1;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}

.revenue-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.revenue-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

/* ========== 订单列表 ========== */
.order-list {
  display: grid;
  gap: 8px;
}

.order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.order-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.order-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
}

.order-avatar.orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.order-info {
  min-width: 0;
}

.order-info strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.order-info span {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

.order-info .order-time {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 2px;
}

.order-value {
  flex-shrink: 0;
  text-align: right;
}

.order-value strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.order-value span {
  display: block;
  font-size: 13px;
  color: var(--green);
  margin-top: 3px;
  font-weight: 500;
}

/* ========== 短信统计 ========== */
.sms-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.sms-stat-card {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}

.sms-stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.sms-stat-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.sms-stat-value small {
  font-size: 13px;
  font-weight: 400;
  color: #94a3b8;
}

/* ========== 短信列表 ========== */
.sms-list {
  display: grid;
  gap: 8px;
}

.sms-item {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.sms-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.sms-item-header strong {
  font-size: 16px;
  font-weight: 600;
}

.sms-status {
  font-size: 14px;
  font-weight: 500;
}

.sms-status.success {
  color: var(--green);
}

.sms-status.fail {
  color: var(--danger);
}

.sms-content {
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 8px;
}

.sms-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #94a3b8;
}

/* ========== 表单 ========== */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 15px;
  font-weight: 500;
  color: #334155;
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  background: var(--soft);
  font-family: inherit;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--brand);
  background: #fff;
}

/* ========== 按钮 ========== */
.primary-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  margin: 20px 0 12px;
}

.logout-full-btn {
  width: 100%;
  padding: 14px;
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
}

/* ========== 操作日志 ========== */
.log-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.log-item:last-child {
  border-bottom: none;
}

.log-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.log-item-header strong {
  font-size: 15px;
  font-weight: 600;
}

.log-item-header span {
  font-size: 13px;
  color: #94a3b8;
}

.log-action {
  font-size: 13px;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.log-item-data {
  background: var(--soft);
  border-radius: 8px;
  padding: 4px 12px;
  line-height: 1.6;
}

.log-field {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.3);
  font-size: 14px;
}

.log-field:last-child {
  border-bottom: none;
}

.log-field-label {
  width: 150px;
  flex-shrink: 0;
  color: #64748b;
}

.log-field-value {
  flex: 1;
  color: #1e293b;
  word-break: break-all;
}

/* ========== 列表底部 ========== */
.list-footer {
  text-align: center;
  padding: 16px 0;
  font-size: 15px;
  color: var(--muted);
}

/* ========== 底部导航 ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 70px;
  padding: 8px 16px 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #ffffff;
  z-index: 50;
}

.bottom-nav .nav-item {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 12px;
  display: grid;
  place-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.bottom-nav .nav-item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav .nav-item.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

/* ========== PC端适配 ========== */
@media (min-width: 769px) {
  .content-area {
    max-width: 480px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    min-height: 100vh;
  }

  .bottom-nav {
    max-width: 480px;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .top-header {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* 详情页隐藏底部导航 */
.detail-page.active ~ .bottom-nav {
  display: none;
}

/* 详情卡片 */
.detail-card {
  background: #fff;
  border-radius: 12px;
  padding: 4px 16px;
  margin-bottom: 12px;
}

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

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

.detail-row span:first-child {
  color: #999;
}

.detail-row span:last-child {
  color: #333;
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

/* 短信记录列表 */
.sms-record-list {
  margin-bottom: 20px;
}

.sms-record-item {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
}

.sms-record-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 15px;
}

.sms-record-top span:first-child {
  font-weight: 600;
  color: #333;
}

.sms-record-time {
  color: #999;
  font-size: 14px;
}

.sms-record-content {
  font-size: 15px;
  color: #666;
  line-height: 1.6;
}

.version-info {
  margin-top: 24px;
  padding: 16px;
  background: var(--soft);
  border-radius: var(--radius-md);
}

.version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  color: var(--muted);
}

.version-row span:last-child {
  color: var(--ink);
  font-weight: 500;
}
