:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --accent: #f97316;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7fa;
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  margin: 0;
}
a { text-decoration: none; color: var(--brand); }
.text-brand { color: var(--brand) !important; }
.text-accent { color: var(--accent) !important; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #ea6a0a; border-color: #ea6a0a; color: #fff; }
.bg-brand { background: var(--brand) !important; }

/* 顶栏 */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.topbar .navbar { padding: .55rem 0; }
.topbar .logo { font-size: 1.35rem; font-weight: 800; color: var(--brand); white-space: nowrap; }
.topbar .logo small { display: block; font-size: .68rem; color: var(--muted); font-weight: 400; }
.main-nav .nav-link { color: var(--ink); font-weight: 500; padding: .4rem .85rem !important; }
.main-nav .nav-link:hover, .main-nav .nav-link.active { color: var(--brand); }
.balance-chip { background: #fff7ed; color: var(--accent); border: 1px solid #fed7aa; border-radius: 999px; padding: .15rem .7rem; font-size: .85rem; font-weight: 600; }

/* 首页 hero */
.hero { background: linear-gradient(120deg, #1e3a8a, #2563eb); color: #fff; padding: 3.2rem 0; }
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: .8rem; }
.hero .search-box { background: #fff; border-radius: 10px; padding: .35rem; display: flex; max-width: 640px; }
.hero .search-box input { border: 0; outline: 0; flex: 1; min-width: 0; padding: .5rem .8rem; font-size: 1rem; }
.hero .search-box .btn { flex-shrink: 0; white-space: nowrap; }
.hero .gift { margin-top: 1.1rem; font-size: .95rem; opacity: .92; }
.hero-stat { display: flex; gap: 2rem; margin-top: 1.4rem; }
.hero-stat b { font-size: 1.4rem; display: block; }

/* 楼层 */
.floor { background: #fff; border-radius: 12px; padding: 1.3rem 1.4rem; margin-bottom: 1.4rem; }
.floor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.floor-head h2 { font-size: 1.15rem; font-weight: 700; margin: 0; padding-left: .7rem; border-left: 4px solid var(--brand); }
.floor-head a { font-size: .88rem; color: var(--muted); }

/* 媒体卡片 */
.media-card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; height: 100%; background: #fff; transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.media-card:hover { box-shadow: 0 8px 24px rgba(37,99,235,.12); transform: translateY(-2px); }
.media-card .m-name { font-weight: 700; font-size: 1rem; line-height: 1.4; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.media-card .m-meta { color: var(--muted); font-size: .8rem; margin: .45rem 0; display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.media-card .m-remark { color: var(--muted); font-size: .78rem; line-height: 1.5; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.media-card .m-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--line); }
.price { color: var(--accent); font-weight: 800; font-size: 1.15rem; }
.price small { font-size: .72rem; font-weight: 400; }
.price-lock { color: var(--brand); font-size: .85rem; font-weight: 600; }
.badge-xkr { background: #eff6ff; color: var(--brand); border: 1px solid #bfdbfe; }
.badge-soft { background: #f3f4f6; color: #374151; }

/* 通用 */
.panel { background: #fff; border-radius: 12px; padding: 1.3rem 1.4rem; }
.filter-label { font-size: .82rem; color: var(--muted); width: 76px; flex: none; padding-top: .35rem; }
.filter-row { display: flex; border-bottom: 1px dashed var(--line); padding: .7rem 0; }
.filter-row .opts { display: flex; flex-wrap: wrap; gap: .35rem; flex: 1; }
.filter-row .opt { border: 1px solid var(--line); background: #fff; color: #374151; border-radius: 999px; padding: .2rem .8rem; font-size: .83rem; cursor: pointer; }
.filter-row .opt:hover, .filter-row .opt.active { border-color: var(--brand); color: var(--brand); background: #eff6ff; }
.sort-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin: 1rem 0; }
.sort-bar a { color: var(--muted); margin-right: 1.2rem; font-size: .9rem; white-space: nowrap; }
.sort-bar a.active { color: var(--brand); font-weight: 700; }
@media (max-width: 575.98px) {
  .sort-bar { flex-direction: column; align-items: stretch; }
  .sort-bar > div:last-child { display: flex; flex-wrap: wrap; row-gap: .4rem; }
}

/* 数据指标 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin: 1rem 0; }
.stat-cell { background: var(--bg); border-radius: 8px; text-align: center; padding: .8rem .4rem; }
.stat-cell b { display: block; font-size: 1.25rem; color: var(--brand); }
.stat-cell span { font-size: .76rem; color: var(--muted); }

/* 用户中心 */
.user-wrap { display: flex; gap: 1.2rem; }
.user-side { width: 210px; flex: none; }
.user-main { flex: 1; min-width: 0; }
.user-menu .list-group-item { border: 0; border-radius: 8px !important; padding: .7rem 1rem; color: #374151; }
.user-menu .list-group-item.active { background: var(--brand); }
.user-menu .list-group-item:hover { background: #eff6ff; }
.user-menu .list-group-item.active:hover { background: var(--brand); }

/* 表格 */
.table thead th { background: #f9fafb; color: #374151; font-size: .85rem; white-space: nowrap; }
.table td { vertical-align: middle; }

/* 状态点 */
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }

/* 页脚 */
.footer { background: #111827; color: #9ca3af; padding: 2.2rem 0 1.4rem; margin-top: 2.5rem; font-size: .88rem; }
.footer a { color: #9ca3af; margin-right: 1.2rem; }
.footer a:hover { color: #fff; }

/* toast */
#toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 3000; }

/* 移动端 */
@media (max-width: 768px) {
  .hero { padding: 2rem 0; }
  .hero h1 { font-size: 1.4rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .user-wrap { flex-direction: column; }
  .user-side { width: 100%; }
  .filter-label { width: 100%; }
  .filter-row { flex-direction: column; gap: .5rem; }
}
