:root {
  --bg: #0f1419;
  --bg-soft: #161d27;
  --card: #1a2330;
  --card-border: #2a3545;
  --text: #e8edf4;
  --text-muted: #8b98a8;
  --accent: #c4a35a;
  --accent-hover: #d4b56a;
  --danger: #c45c5c;
  --success: #4a9b6e;
  --line: #243041;
  --radius: 8px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: linear-gradient(180deg, #0c1117 0%, #121820 40%, #0f1419 100%);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

.app-wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: 72px; background: transparent; }
.page { padding: 16px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  background: rgba(15,20,25,.92); position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.topbar h1 { font-size: 16px; font-weight: 600; letter-spacing: .04em; color: var(--text); }
.topbar .back { color: var(--text-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

.banner {
  height: 140px; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(135deg, #1e2a3a 0%, #2a3a4f 50%, #1a2838 100%);
  border: 1px solid var(--card-border);
  display: flex; align-items: flex-end; padding: 16px; margin-bottom: 14px;
  position: relative;
}
.banner::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(196,163,90,.12), transparent 60%);
}
.banner .txt { position: relative; z-index: 1; }
.banner .txt strong { display: block; font-size: 18px; font-weight: 600; letter-spacing: .06em; }
.banner .txt span { color: var(--text-muted); font-size: 12px; }

.banner-slider {
  position: relative; margin-bottom: 14px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--card-border); min-height: 140px; background: var(--card);
}
.banner-slide { display: none; }
.banner-slide.active { display: block; }
.banner-slide img { width: 100%; height: 140px; object-fit: cover; display: block; }
.banner-slider .banner-fallback { margin-bottom: 0; border: none; border-radius: 0; height: 140px; }
.banner-dots {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; justify-content: center; gap: 6px; z-index: 2;
}
.banner-dots .dot {
  width: 6px; height: 6px; border-radius: 50%; border: none; padding: 0;
  background: rgba(255,255,255,.35); cursor: pointer;
}
.banner-dots .dot.active { background: var(--accent); }

.copy-btn {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border: 1px solid var(--card-border); border-radius: 4px; background: #222c3a;
  color: var(--accent); font-size: 12px; cursor: pointer; font-family: inherit;
}
.copy-btn:hover { border-color: var(--accent); }

.icon-panel {
  margin-bottom: 18px;
  padding: 14px 8px 10px;
  background: linear-gradient(180deg, rgba(26,35,48,.95) 0%, rgba(18,24,32,.9) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 4px;
}
.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 8px 4px;
  color: var(--text);
  text-align: center;
  border-radius: 8px;
  transition: background .15s ease;
}
.icon-item:hover,
.icon-item:active {
  background: rgba(196,163,90,.08);
  color: var(--text);
}
.icon-item .ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #222c3a;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(196,163,90,.18);
}
.icon-item .ico svg { width: 20px; height: 20px; }
.icon-item span {
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-muted);
  max-width: 100%;
  word-break: break-all;
}

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 0 12px;
}
.section-head h2 { font-size: 15px; font-weight: 600; letter-spacing: .03em; }
.section-head a { font-size: 12px; color: var(--text-muted); }

.product-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.product-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }

.product-card {
  min-width: 160px; max-width: 180px; flex: 0 0 auto;
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  overflow: hidden;
}
.product-card .cover {
  height: 100px; background: #222c3a;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 12px;
}
.product-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 10px; }
.product-card .title { font-size: 13px; font-weight: 500; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.product-card .price { color: var(--accent); font-weight: 600; font-size: 14px; }
.product-card .price small { font-weight: 400; font-size: 11px; color: var(--text-muted); margin-left: 2px; }

.product-list .item {
  display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.product-list .item:last-child { border-bottom: none; }
.product-list .thumb {
  width: 72px; height: 72px; border-radius: 6px; background: #222c3a; flex-shrink: 0;
  overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 11px;
}
.product-list .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-list .meta { flex: 1; min-width: 0; }
.product-list .meta h3 { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.product-list .meta p { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-list .meta .row { display: flex; align-items: center; justify-content: space-between; }
.product-list .meta .price { color: var(--accent); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 500; font-family: inherit;
  background: var(--accent); color: #1a1408; transition: background .15s;
}
.btn:hover { background: var(--accent-hover); color: #1a1408; }
.btn-block { width: 100%; }
.btn-outline {
  background: transparent; border: 1px solid var(--card-border); color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.form-control {
  width: 100%; height: 42px; padding: 0 12px;
  background: #121820; border: 1px solid var(--card-border); border-radius: 6px;
  color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.form-control:focus { border-color: var(--accent); }
textarea.form-control { height: auto; padding: 10px 12px; min-height: 90px; resize: vertical; }
.input-unit { position: relative; }
.input-unit .unit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-size: 12px; font-weight: 500;
}
.input-unit .form-control { padding-right: 64px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.hint a { color: var(--accent); }

.upload-box {
  border: 1px dashed #3a4a5c; border-radius: 6px; padding: 28px 12px; text-align: center;
  background: #121820; cursor: pointer; color: var(--text-muted);
}
.upload-box:hover { border-color: var(--accent); }
.upload-box .ico { width: 28px; height: 28px; margin: 0 auto 8px; color: var(--accent); }
.upload-box .ico svg { width: 28px; height: 28px; }
.upload-box strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }
.upload-box input { display: none; }
.upload-preview { margin-top: 10px; max-height: 160px; border-radius: 6px; }

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(18,24,32,.96); border-top: 1px solid var(--line);
  backdrop-filter: blur(8px); z-index: 30; height: 58px;
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-muted); font-size: 11px;
}
.tabbar a svg { width: 20px; height: 20px; }
.tabbar a.active { color: var(--accent); }

.alert {
  padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px;
  border: 1px solid transparent;
}
.alert-error { background: rgba(196,92,92,.12); border-color: rgba(196,92,92,.35); color: #e8a0a0; }
.alert-success { background: rgba(74,155,110,.12); border-color: rgba(74,155,110,.35); color: #8fd4ae; }
.alert-info { background: rgba(196,163,90,.1); border-color: rgba(196,163,90,.3); color: #e0c78a; }

.user-hero {
  background: linear-gradient(135deg, #1a2838, #243447);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 18px 16px; margin-bottom: 14px;
}
.user-hero .name { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.user-hero .sub { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.user-hero .assets { display: flex; justify-content: space-between; align-items: flex-end; }
.user-hero .assets .lab { font-size: 12px; color: var(--text-muted); }
.user-hero .assets .val { font-size: 24px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }
.user-hero .actions { display: flex; gap: 8px; margin-top: 14px; }
.user-hero .actions .btn { flex: 1; }

.menu-list { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); overflow: hidden; }
.menu-list a {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  color: var(--text); border-bottom: 1px solid var(--line); font-size: 14px;
}
.menu-list a:last-child { border-bottom: none; }
.menu-list a .ico { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.menu-list a .ico svg { width: 20px; height: 20px; }
.menu-list a .arrow { margin-left: auto; color: var(--text-muted); font-size: 12px; }

.table-list .row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.table-list .row:last-child { border-bottom: none; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px;
  background: #243041; color: var(--text-muted);
}
.badge-ok { background: rgba(74,155,110,.2); color: #8fd4ae; }
.badge-wait { background: rgba(196,163,90,.2); color: #e0c78a; }
.badge-no { background: rgba(196,92,92,.2); color: #e8a0a0; }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-box { width: 100%; max-width: 400px; }
.auth-box .brand { text-align: center; margin-bottom: 28px; }
.auth-box .brand h1 { font-size: 22px; font-weight: 600; letter-spacing: .08em; margin-bottom: 6px; }
.auth-box .brand p { color: var(--text-muted); font-size: 13px; }

.footer-link { text-align: center; margin-top: 16px; color: var(--text-muted); font-size: 13px; }

.detail-cover {
  height: 200px; background: #222c3a; border-radius: var(--radius); margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center; color: var(--text-muted); overflow: hidden;
  border: 1px solid var(--card-border);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.price-lg { font-size: 26px; color: var(--accent); font-weight: 600; margin: 8px 0; }
.price-lg small { font-size: 13px; color: var(--text-muted); font-weight: 400; }

.admin-body { overflow-x: hidden; }
.admin-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 12px 28px;
  width: 100%;
  box-sizing: border-box;
}
.admin-header { margin-bottom: 12px; }
.admin-header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.admin-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.admin-user {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}
.admin-menu-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}
.admin-menu-label { font-weight: 500; color: var(--accent); }
.admin-menu-icon {
  width: 18px;
  height: 14px;
  position: relative;
  flex-shrink: 0;
}
.admin-menu-icon::before,
.admin-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: transform .2s ease, top .2s ease;
}
.admin-menu-icon::before { top: 2px; box-shadow: 0 5px 0 var(--accent); }
.admin-menu-icon::after { top: 12px; }
.admin-menu-btn.is-open .admin-menu-icon::before {
  top: 6px;
  box-shadow: none;
  transform: rotate(45deg);
}
.admin-menu-btn.is-open .admin-menu-icon::after {
  top: 6px;
  transform: rotate(-45deg);
}
.admin-nav {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: rgba(18, 24, 32, .65);
}
.admin-nav.is-open { display: flex; }
.admin-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 14px;
}
.admin-nav a.active, .admin-nav a:hover {
  color: var(--accent);
  border-color: var(--card-border);
  background: var(--card);
}
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-toolbar .form-control {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
}
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
.admin-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th, .admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.admin-table th { color: var(--text-muted); font-weight: 500; }
.admin-table td .btn { margin: 2px 0; }
.admin-table .empty { white-space: normal; }
.admin-table img.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--card-border); }
.admin-table img.thumb-lg { width: 88px; height: 66px; object-fit: cover; }
.admin-img-preview {
  margin-top: 10px;
  padding: 10px;
  background: #121820;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
}
.admin-img-preview img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  background: #0d1218;
}
.admin-img-preview .hint { margin: 8px 0 0; }
.admin-layout .card { overflow: hidden; }
.admin-layout .form-control,
.admin-layout textarea.form-control,
.admin-layout select.form-control {
  max-width: 100%;
  box-sizing: border-box;
}
.admin-layout .btn { max-width: 100%; }
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
}
.stat .lab { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat .val { font-size: 18px; font-weight: 600; color: var(--accent); word-break: break-all; }

@media (min-width: 768px) {
  .admin-layout { padding: 20px; }
  .admin-title { font-size: 18px; }
  .admin-menu-btn { display: none; }
  .admin-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0 0 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }
  .admin-nav a {
    display: inline-block;
    padding: 8px 12px;
    font-size: 13px;
  }
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
  }
  .stat { padding: 14px; }
  .stat .val { font-size: 20px; }
}

@media (min-width: 1024px) {
  .stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.empty { text-align: center; padding: 36px 12px; color: var(--text-muted); font-size: 13px; }

.recharge-page { padding-bottom: 28px; }
.recharge-hero {
  background: linear-gradient(145deg, #1a2838 0%, #243447 55%, #182230 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.recharge-hero::before {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  border: 1px solid rgba(196,163,90,.35);
}
.recharge-hero .lab {
  font-size: 11px; letter-spacing: .12em; color: var(--accent); margin-bottom: 8px; font-weight: 600;
}
.recharge-hero h2 { font-size: 22px; font-weight: 600; margin-bottom: 8px; letter-spacing: .04em; }
.recharge-hero p { color: var(--text-muted); font-size: 13px; line-height: 1.6; position: relative; z-index: 1; }
.recharge-panel { background: #171f2b; }
.recharge-qr { text-align: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.recharge-qr img {
  max-width: 180px; border-radius: 8px; border: 1px solid var(--card-border);
  background: #0f1419; padding: 8px;
}

@media (min-width: 768px) {
  .app-wrap { box-shadow: 0 0 0 1px var(--line); }
}
