/* ============================================================
   appstore 前台样式 —— 抄 erp 的设计语言(www/shared_admin/css/ui-kit.css 那套精简 SaaS 风):
   同一套色板 / 圆角 / 阴影 / 字体栈 / 表格与卡片观感, 用户认为 erp 是站群里调得最好看的一个。

   与 erp 的区别(有意为之):
   - erp 是后台: 侧栏 + Bootstrap + Alpine + CDN。本站是**公开 SEO 站**, 首屏不赌第三方 CDN,
     也不需要侧栏 —— 改成顶栏 + 内容流, 组件按同一 token 手写。
   - 自适应: 桌面 <=1120px 容器 + 两列布局; 移动端单列 / 导航横滑 / 版本表转卡片。
   ============================================================ */

:root {
    /* ↓ 与 shared_admin/ui-kit.css 逐值一致, 换主色改这里 */
    --bg: #f6f7f9; --surface: #fff; --surface-2: #fafbfc; --hover: #f4f5f8;
    --border: #e7e9ee; --border-2: #eef0f4;
    --text: #1a1f2b; --muted: #6b7385; --faint: #9aa1b1;
    --primary: #4263eb; --primary-weak: #eef1fe; --primary-hover: #3651c9;
    --ok: #12b76a; --ok-weak: #e7f7ee; --warn: #f79009; --warn-weak: #fef3e2;
    --danger: #f04438; --danger-weak: #fdeceb;
    --r-lg: 12px; --r: 9px; --r-sm: 6px;
    --sh-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --sh: 0 4px 16px rgba(16, 24, 40, .07);
    --sh-lg: 0 12px 32px rgba(16, 24, 40, .12);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { border-style: none; }
h1, h2, h3 { letter-spacing: -.01em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶栏(erp topbar 的公开站版本) ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.top-in { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); flex: none; }
.brand:hover { color: var(--text); }
.brand .logo {
    width: 30px; height: 30px; border-radius: 8px; flex: none;
    background: linear-gradient(135deg, var(--primary), #7c8cf7);
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.brand .logo svg { width: 18px; height: 18px; }

.search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border);
          border-radius: var(--r); padding: 6px 10px; flex: 1; max-width: 420px; }
.search input { border: 0; background: transparent; outline: 0; flex: 1; min-width: 0; font-size: 13.5px; color: var(--text); font-family: inherit; }
.search button { border: 0; background: var(--primary); color: #fff; border-radius: var(--r-sm);
                 padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; flex: none; }
.search button:hover { background: var(--primary-hover); }

.top-auth { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; flex: none; }
.top-auth a { color: var(--muted); }
.top-auth a:hover { color: var(--text); }
.top-auth .cta { color: #fff; background: var(--primary); padding: 6px 13px; border-radius: var(--r); font-weight: 600; }
.top-auth .cta:hover { background: var(--primary-hover); color: #fff; }

/* 搜索联想下拉(顶栏 .search 内绝对定位) */
.search { position: relative; }
.sug { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface);
       border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; z-index: 40; }
.sug-i { padding: 8px 12px; font-size: 13.5px; cursor: pointer; color: var(--text); }
.sug-i.on, .sug-i:hover { background: var(--primary-weak); color: var(--primary); }

/* 收藏按钮(详情页 hero 内, 与下载按钮并排) */
.fav { background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: var(--r);
       padding: 10px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.fav:hover { background: var(--hover); color: var(--text); }
.fav[data-on="1"] { background: var(--primary-weak); color: var(--primary); border-color: var(--primary); }
.hero-act { display: flex; gap: 10px; align-items: stretch; margin-top: 16px; flex-wrap: wrap; }
.hero-act .btn.big { margin-top: 0; flex: 1; min-width: 220px; }

/* ---------- 分类导航(erp nav-item 的 pill 化) ---------- */
.nav { background: var(--surface); border-bottom: 1px solid var(--border); }
.nav-in { display: flex; gap: 6px; overflow-x: auto; padding: 9px 0; scrollbar-width: none; }
.nav-in::-webkit-scrollbar { display: none; }
.nav-in a { flex: none; padding: 5px 12px; border-radius: var(--r); color: var(--muted); font-size: 13px;
            font-weight: 500; white-space: nowrap; transition: background .12s, color .12s; }
.nav-in a:hover { background: var(--hover); color: var(--text); }
.nav-in a.on { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.nav-in a i { font-style: normal; opacity: .6; margin-left: 4px; font-size: 11.5px; }

main { padding: 20px 0 40px; }

/* ---------- 区块标题 ---------- */
.sec { margin-bottom: 20px; }
.sec-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-hd h1, .sec-hd h2 { margin: 0; font-size: 18px; font-weight: 700; }
.sec-hd .more { font-size: 13px; color: var(--muted); }
.sec-hd .more:hover { color: var(--primary); }
.lede { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
        box-shadow: var(--sh-sm); padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 10px; font-size: 15px; font-weight: 700; }

/* ---------- 应用列表(桌面两列, 移动单列) ---------- */
.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row { min-width: 0; display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border);
       border-radius: var(--r-lg); box-shadow: var(--sh-sm); padding: 12px 14px; transition: box-shadow .12s, border-color .12s; }
.row:hover { box-shadow: var(--sh); border-color: #dcdfe8; }
.ico { width: 52px; height: 52px; border-radius: 12px; background: var(--surface-2); object-fit: cover; flex: none; }
.ico-ph { display: flex; align-items: center; justify-content: center; color: var(--faint); font-weight: 700; font-size: 18px; }
.row .meta { min-width: 0; flex: 1; }
.row .name { display: block; font-size: 14.5px; font-weight: 600; color: var(--text);
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name:hover { color: var(--primary); }
.row .sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub2 { color: var(--faint); font-size: 12px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- pill(erp .uk-pill, 去掉圆点版) ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
        background: var(--primary-weak); color: var(--primary); margin-right: 6px; }
.pill.mute { background: var(--hover); color: var(--muted); }
.pill.warn { background: var(--warn-weak); color: var(--warn); }
.pill.dng { background: var(--danger-weak); color: var(--danger); }

/* ---------- 热门格(erp stat 卡的缩小版) ---------- */
.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.cell { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm);
        padding: 14px 8px; text-align: center; transition: box-shadow .12s; }
.cell:hover { box-shadow: var(--sh); }
.cell .ico { width: 46px; height: 46px; margin: 0 auto 8px; display: block; }
.cell .name { display: block; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 详情页 ---------- */
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
        box-shadow: var(--sh-sm); padding: 20px; margin-bottom: 16px; }
.hero-top { display: flex; gap: 16px; align-items: center; }
.hero .ico { width: 80px; height: 80px; border-radius: 18px; }
.hero h1 { margin: 0 0 4px; font-size: 21px; font-weight: 750; }
.hero .pkg { color: var(--faint); font-size: 12px; word-break: break-all; margin-top: 3px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
       background: var(--primary); color: #fff; border-radius: var(--r); padding: 10px 20px;
       font-size: 14px; font-weight: 600; font-family: inherit; }
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn.big { padding: 13px 30px; font-size: 15px; width: 100%; margin-top: 16px; }
.btn.ghost { background: var(--surface); color: var(--primary); border: 1px solid var(--border); font-weight: 600; }
.btn.ghost:hover { background: var(--primary-weak); border-color: var(--primary); }
.btn.sm { padding: 6px 14px; font-size: 12.5px; }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.big small { font-weight: 400; opacity: .85; font-size: 12px; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.fact { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.fact dt { color: var(--faint); font-size: 11.5px; font-weight: 500; }
.fact dd { margin: 3px 0 0; font-size: 13.5px; font-weight: 600; }

.text { color: var(--muted); font-size: 13.5px; line-height: 1.75; }
.log { background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; color: var(--muted);
       font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; max-height: 380px; overflow: auto; }
.perms { display: flex; flex-wrap: wrap; gap: 6px; }
.perms span { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r-sm);
              padding: 3px 9px; font-size: 12px; color: var(--muted); }
.shots { display: flex; gap: 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.shots img { height: 260px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); flex: none; }

/* ---------- 版本归档表(erp .uk-tbl) ---------- */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase;
          letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--border-2); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .na { color: var(--faint); }

/* ---------- 表单(erp .form-control) ---------- */
.f { margin-bottom: 14px; }
.f label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 5px; }
.f input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r);
           font-size: 13.5px; background: var(--surface); color: var(--text); font-family: inherit; }
.f input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.f .row2 { display: flex; gap: 8px; }
.auth { max-width: 400px; margin: 0 auto; }
.tip { min-height: 20px; font-size: 13px; margin-bottom: 6px; }

/* ---------- 分页 / 面包屑 / 页脚 / 空态 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 22px 0 4px; font-size: 13px; }
.pager a, .pager span { padding: 5px 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); }
.pager span { color: var(--muted); border-color: transparent; background: transparent; }
.pager a:hover { background: var(--hover); }
.crumb { font-size: 12.5px; color: var(--faint); margin-bottom: 12px; }
.crumb a { color: var(--muted); }
.empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
         padding: 40px 16px; text-align: center; color: var(--muted); }
.foot { border-top: 1px solid var(--border); margin-top: 28px; padding: 18px 0 34px; color: var(--faint); font-size: 12.5px; }
.foot a { color: var(--muted); }

/* ============================================================
   自适应: erp 的断点是 768px, 这里沿用
   ============================================================ */
@media (max-width: 768px) {
    .top-in { height: 54px; gap: 10px; }
    .brand span { display: none; }             /* 窄屏只留 logo, 把宽度让给搜索 */
    .search { max-width: none; }
    .top-auth { gap: 8px; font-size: 12.5px; }
    .top-auth .cta { padding: 5px 10px; }

    .list { grid-template-columns: minmax(0, 1fr); }   /* 单列 */
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .hero { padding: 16px; }
    .hero-top { gap: 12px; }
    .hero .ico { width: 64px; height: 64px; border-radius: 14px; }
    .hero h1 { font-size: 18px; }
    .shots img { height: 190px; }

    /* 版本表: 窄屏把表转成卡片, 不横向溢出 */
    .tbl thead { display: none; }
    .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
    .tbl tr { border: 1px solid var(--border-2); border-radius: var(--r); padding: 10px 12px; margin-bottom: 8px; }
    .tbl tr:hover td { background: transparent; }
    .tbl td { border: 0; padding: 2px 0; word-break: break-word; }
    .tbl td[data-l]::before { content: attr(data-l) ": "; color: var(--faint); font-size: 12px; }
    .tbl td.act { margin-top: 8px; }
    .tbl td.act .btn { width: 100%; }
}

@media (max-width: 420px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 标签行(详情页 -> 标签页内链) */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags .pill { text-decoration: none; }
.tags .pill:hover { background: var(--primary-weak, #eef2ff); color: var(--primary); }

/* 用户评分/短评(D) */
.rv-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.rv-form input[name=c] { flex: 1 1 260px; min-width: 0; }
.rv-list { display: grid; gap: 10px; }
.rv { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md, 8px); padding: 9px 11px; }
.rv-hd { font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.rv-c { font-size: 14px; margin-top: 4px; word-break: break-word; }
