/* ==========================================================================
   AppDoge 应用商店 · 全站样式
   --------------------------------------------------------------------------
   设计语言沿用 ZChat（iOS 平面风）：
     · 底色 #EFEFF4、面板 #FFF、分隔线 #E5E5EA、主色 #007AFF、15px 基准字号
     · 列表「通栏 + 直角」，只有分隔线，不用圆角卡片
     · 手机单栏铺满；≥768px 变「悬浮卡片 + 侧边栏」
     · 深色模式与 ZChat 同一套色板（#1C1C1E / #2C2C2E / #48484A）

   兼容性约定（改样式前请先读这段）
   --------------------------------------------------------------------------
   目标环境包含 iOS 5 Safari（WebKit 534）与 Android 4.x 原生浏览器，
   它们既不支持 CSS 变量，也不支持 flex 的 gap / grid / calc / sticky。
   所以：
     1. 布局只用 CSS 2.1：block / inline-block / float / table-cell；
        桌面端的侧边栏 + 卡片网格包在 @supports (display: flex) 里，
        旧引擎读不到就退化成「侧边栏 + 通栏列表」，不会出现半坏状态。
     2. 需要纵向居中或等宽排列时，用 display:-webkit-box（2009 版 flex），
        iOS 5 支持它；同时写上 -webkit-flex / flex，新浏览器用新的。
     3. 每个颜色写两条声明：先字面量，再 var()。
        旧浏览器不认识 var() 会丢弃第二条，拿到字面量；新浏览器用变量，深色模式生效。
     4. 图标居中一律「绝对定位 + 负 margin」，不用 grid / place-items。
     5. 圆角、阴影、过渡、变形都带 -webkit- 前缀。
     6. 不用 gap，改用 margin；不用 inset，改写 top/right/bottom/left。
   ========================================================================== */

/* ---------- 1. 设计变量（旧浏览器读不到，靠下面的字面量兜底） ---------- */
:root {
    --bg: #EFEFF4;            /* 页面/内容区底色 */
    --page: #F0F0F0;          /* PC 端外壳外的底色 */
    --surface: #FFFFFF;       /* 卡片、列表行 */
    --chrome: #FFFFFF;        /* 顶栏、侧边栏 */
    --fill: #F7F7F8;          /* 次级填充 */
    --line: #E5E5EA;          /* 行内分隔线 */
    --line-strong: #C8C8CC;   /* 结构线（顶栏底边） */
    --text: #000000;
    --text-2: #8E8E93;
    --text-3: #C7C7CC;
    --accent: #007AFF;
    --accent-press: #0062CC;
    --accent-soft: rgba(0, 122, 255, .10);
    --danger: #FF3B30;
    --green: #34C759;
    --ph: #E9E9EE;            /* 图标占位底色 */
    --shadow: 0 2px 20px rgba(0, 0, 0, .08);
    --radius: 12px;
}

[data-theme="dark"] {
    --bg: #1C1C1E;
    --page: #111111;
    --surface: #2C2C2E;
    --chrome: #2C2C2E;
    --fill: #3A3A3C;
    --line: #48484A;
    --line-strong: #48484A;
    --text: #FFFFFF;
    --text-2: #8E8E93;
    --text-3: #636366;
    --accent: #0A84FF;
    --accent-press: #0070E0;
    --accent-soft: rgba(10, 132, 255, .18);
    --danger: #FF453A;
    --green: #30D158;
    --ph: #3A3A3C;
    --shadow: 0 2px 20px rgba(0, 0, 0, .55);
}

/* ---------- 2. 重置 ---------- */
*, *:before, *:after {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
}

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
    min-height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Helvetica Neue", "Microsoft YaHei", "微软雅黑", "WenQuanYi Micro Hei",
                 Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: #000000;
    color: var(--text);
    background: #EFEFF4;
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* hidden 属性在旧 WebKit 里没有内置样式，这里补一条，且压过 display:flex */
[hidden] { display: none !important; }

img { display: block; max-width: 100%; border: 0; }
a { color: #007AFF; color: var(--accent); text-decoration: none; }
svg { display: block; }

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input, textarea, select { font: inherit; color: inherit; }
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { display: none; }

/* 旧 WebKit 用单冒号写法，新浏览器两者都认 */
::-webkit-input-placeholder { color: #8E8E93; }
::placeholder { color: #8E8E93; color: var(--text-2); }

/* ---------- 3. 骨架 ---------- */
.shell {
    background: #EFEFF4;
    background: var(--bg);
}

.main { min-width: 0; }

.content { padding-bottom: 34px; }

/* 手机端顶栏（ZChat 的 50px 白条 + 细底边） */
.topbar {
    position: relative;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 30;
    height: 50px;
    padding: 0 56px;
    background: #FFFFFF;
    background: var(--chrome);
    border-bottom: 1px solid #C8C8CC;
    border-bottom-color: var(--line-strong);
    text-align: center;
}

.topbar-title {
    display: inline-block;
    max-width: 100%;
    font-size: 17px;
    font-weight: 600;
    line-height: 50px;
    letter-spacing: .2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

/* 手机上没有侧边栏，顶栏左侧放个小图标，跟后台保持同一套视觉 */
.topbar > .topbar-logo {
    position: absolute;
    left: 12px;
    top: 13px;
    width: 24px;
    height: 24px;
    border-radius: 5px;
}

/* 宽屏侧边栏里已经有 LOGO，顶栏这个就藏掉 */
@media (min-width: 768px) {
    .topbar > .topbar-logo { display: none; }
}

/* 用 .topbar > 提高权重：.icon-btn 自己也写了 position:relative，
   否则同权重下后定义的 relative 会把这里的 absolute 顶掉 */
.topbar > .topbar-btn {
    position: absolute;
    right: 8px;
    top: 6px;
}

/* 通用图标按钮：内部 svg 绝对居中，避免依赖 grid */
.icon-btn {
    position: relative;
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    color: #000000;
    color: var(--text);
    -webkit-transition: background .15s;
    transition: background .15s;
}
.icon-btn:active { background: #F7F7F8; background: var(--fill); }
.icon-btn svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 21px;
    height: 21px;
    margin: -10px 0 0 -10px;
}

/* ---------- 4. 侧边栏（仅 PC） ---------- */
.sidebar { display: none; }

.brand { padding: 0 6px 18px; }

.brand-logo {
    float: left;
    width: 34px;
    height: 34px;
    margin-right: 10px;
    /* 图标自带圆角，这里按 20% 匹配，避免二次裁切出现双层圆角 */
    border-radius: 7px;
}

.brand-text { overflow: hidden; }

.brand-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .2px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-sub {
    margin-top: 1px;
    font-size: 12px;
    color: #8E8E93;
    color: var(--text-2);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav { display: block; }
.nav-item + .nav-item { margin-top: 2px; }

.nav-item {
    position: relative;
    display: block;
    width: 100%;
    padding: 9px 10px 9px 38px;
    border-radius: 9px;
    font-size: 14.5px;
    color: #000000;
    color: var(--text);
    text-align: left;
    -webkit-transition: background .15s, color .15s;
    transition: background .15s, color .15s;
}
.nav-item svg {
    position: absolute;
    left: 10px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    color: #8E8E93;
    color: var(--text-2);
}
.nav-item:hover { background: #F7F7F8; background: var(--fill); }
.nav-item.is-active {
    background: rgba(0, 122, 255, .10);
    background: var(--accent-soft);
    color: #007AFF;
    color: var(--accent);
    font-weight: 500;
}
.nav-item.is-active svg { color: #007AFF; color: var(--accent); }

.nav-count {
    float: right;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 400;
    color: #8E8E93;
    color: var(--text-2);
}
.nav-item.is-active .nav-count { color: #007AFF; color: var(--accent); }

.side-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #E5E5EA;
    border-top-color: var(--line);
}

.side-copy {
    padding: 10px 10px 0;
    font-size: 11px;
    color: #8E8E93;
    color: var(--text-2);
    line-height: 1.6;
}

/* ---------- 5. 搜索 ---------- */
/* 手机端是普通块级流；PC 端把「小节标题 + 搜索」并成一行（见文件末尾媒体查询） */
.store-head { display: block; }

.toolbar { padding: 10px 15px 0; }

/* 搜索框内部全部绝对定位，不用 flex，也不用 gap */
.search-field {
    position: relative;
    display: block;
    height: 36px;
    padding: 0 34px 0 33px;
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid transparent;
    border-radius: 10px;
    -webkit-transition: border-color .15s;
    transition: border-color .15s;
}
.search-field.is-focus,
.search-field:focus-within {
    border-color: #007AFF;
    border-color: var(--accent);
}
.search-field > svg {
    position: absolute;
    left: 10px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    color: #8E8E93;
    color: var(--text-2);
}

.search-input {
    display: block;
    width: 100%;
    height: 34px;
    padding: 0;
    background: none;
    border: 0;
    outline: none;
    font-size: 16px;         /* ≥16px，避免 iOS 聚焦时自动放大页面 */
    line-height: 34px;
    color: #000000;
    color: var(--text);
    -webkit-appearance: none;
    border-radius: 0;
}
.search-input::-webkit-input-placeholder { color: #8E8E93; }
.search-input:focus { outline: none; }

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border-radius: 9px;
    background: #C7C7CC;
    background: var(--text-3);
    color: #FFFFFF;
    color: var(--surface);
}
.search-clear svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
}

/* ---------- 6. 分段控件（ZChat 蓝框胶囊） ---------- */
.segments {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    margin: 10px 15px 0;
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid #007AFF;
    border-color: var(--accent);
    border-radius: 8px;
    overflow: hidden;
}

.seg {
    display: block;
    width: 1%;
    padding: 6px 0;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    font-size: 13px;
    color: #007AFF;
    color: var(--accent);
    text-align: center;
    border-right: 1px solid #007AFF;
    border-right-color: var(--accent);
    -webkit-transition: background .15s, color .15s;
    transition: background .15s, color .15s;
}
.seg:last-child { border-right: 0; }
.seg.is-active {
    background: #007AFF;
    background: var(--accent);
    color: #fff;
    font-weight: 500;
}

/* 深色下未选中项的文字同样提亮一档 */
[data-theme="dark"] .seg { color: #5AB0FF; border-right-color: rgba(90, 176, 255, .45); }
[data-theme="dark"] .segments { border-color: rgba(90, 176, 255, .55); }
[data-theme="dark"] .seg.is-active { color: #fff; }

/* ---------- 7. 小节标题 ---------- */
.section-head {
    overflow: hidden;
    padding: 14px 15px 7px;
}

.section-title {
    float: left;
    font-size: 13px;
    font-weight: 400;
    color: #8E8E93;
    color: var(--text-2);
}

.section-count {
    float: right;
    font-size: 12.5px;
    color: #8E8E93;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

/* ---------- 8. 应用列表（一套 DOM，手机是行、PC 是卡片） ---------- */
.app-list {
    background: #FFFFFF;
    background: var(--surface);
}

.app-item {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 11px 15px;
    cursor: pointer;
    -webkit-transition: background .15s;
    transition: background .15s;
}
.app-item:active { background: #F7F7F8; background: var(--fill); }
.app-item:focus { outline: none; }

/* 分隔线缩进到图标右侧，和 ZChat 的聊天列表同款（绝对定位，不占 flex 位） */
.app-item:after {
    content: "";
    position: absolute;
    left: 85px;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #E5E5EA;
    background: var(--line);
    pointer-events: none;
}
.app-item:last-child:after { display: none; }

.app-icon {
    position: relative;
    width: 58px;
    height: 58px;
    margin-right: 12px;
    border-radius: 13px;
    overflow: hidden;
    background: #E9E9EE;
    background: var(--ph);
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
}
.app-icon img { display: block; width: 100%; height: 100%; }
.app-icon .ph {
    display: none;
    width: 100%;
    font-size: 24px;
    font-weight: 600;
    line-height: 58px;
    text-align: center;
    color: #8E8E93;
    color: var(--text-2);
}
.app-icon.is-ph .ph { display: block; }

.app-info {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-name {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-meta {
    margin-top: 3px;
    font-size: 12.5px;
    color: #8E8E93;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-meta .dot { margin: 0 5px; opacity: .55; }

/* 「下载」按钮：手机是小胶囊，PC 是整行浅蓝块 */
.app-get {
    display: inline-block;
    min-width: 62px;
    height: 29px;
    margin-left: 12px;
    padding: 0 15px;
    border-radius: 15px;
    background: rgba(0, 122, 255, .10);
    background: var(--accent-soft);
    color: #007AFF;
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 29px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    -webkit-transition: background .15s, color .15s;
    transition: background .15s, color .15s;
}
.app-get:active { opacity: .65; }

/* 深色下 --accent 压在深底上对比度偏低，按钮文字单独提亮一档 */
[data-theme="dark"] .app-get {
    background: rgba(10, 132, 255, .22);
    color: #5AB0FF;
}

/* ---------- 9. 空状态 / 页脚 ---------- */
.empty {
    padding: 56px 24px 40px;
    text-align: center;
    background: #FFFFFF;
    background: var(--surface);
}

.empty-icon {
    position: relative;
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 16px;
    background: #F7F7F8;
    background: var(--fill);
    color: #C7C7CC;
    color: var(--text-3);
}
.empty-icon svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
}

.empty-title { font-size: 15px; color: #000000; color: var(--text); }
.empty-sub {
    margin-top: 5px;
    font-size: 13px;
    color: #8E8E93;
    color: var(--text-2);
}

.page-foot {
    padding: 26px 15px 6px;
    text-align: center;
    font-size: 12px;
    color: #8E8E93;
    color: var(--text-2);
    line-height: 1.7;
}
.page-foot a { color: #8E8E93; color: var(--text-2); }

/* ---------- 10. 应用详情弹层（ZChat action sheet 风格） ---------- */
/* 用「inline-block 撑高 + vertical-align:bottom」把面板贴底，
   iOS 5 没有 flex-end 也能正确定位 */
.sheet-mask {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    padding: 8px;
    background: rgba(0, 0, 0, .4);
    text-align: center;
    /* 关键：清掉 HTML 里的换行空白，否则 .sheet 会被挤到「撑高元素」的下一行 */
    font-size: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    -webkit-transition: opacity .22s ease, visibility .22s ease;
    transition: opacity .22s ease, visibility .22s ease;
}
.sheet-mask:before {
    content: "";
    display: inline-block;
    width: 0;
    height: 100%;
    vertical-align: bottom;
}
.sheet-mask.is-open { opacity: 1; visibility: visible; }

.sheet {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 100%;
    font-size: 15px;
    text-align: left;
    vertical-align: bottom;
    -webkit-transform: translateY(100%);
    transform: translateY(100%);
    -webkit-transition: -webkit-transform .3s cubic-bezier(.32, .72, 0, 1);
    transition: transform .3s cubic-bezier(.32, .72, 0, 1);
}
.sheet-mask.is-open .sheet {
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.sheet-body {
    padding: 18px 16px 16px;
    background: #FFFFFF;
    background: var(--surface);
    border-radius: 14px;
}

.sheet-app { padding-bottom: 14px; }

.sheet-app .app-icon { float: left; margin-right: 13px; }

.app-icon.lg { width: 68px; height: 68px; border-radius: 16px; }
.app-icon.lg .ph { font-size: 28px; line-height: 68px; }

.sheet-app-info { overflow: hidden; min-height: 68px; }

.sheet-name {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sheet-meta {
    margin-top: 4px;
    font-size: 13px;
    color: #8E8E93;
    color: var(--text-2);
}

/* 弹层里的信息表，复用 ZChat 的 ios-group / ios-cell */
.ios-group {
    background: #F7F7F8;
    background: var(--fill);
    border-radius: 10px;
    overflow: hidden;
}

.ios-cell {
    position: relative;
    min-height: 42px;
    padding: 0 13px;
    font-size: 14.5px;
    line-height: 42px;
    overflow: hidden;
}
.ios-cell:after {
    content: "";
    position: absolute;
    left: 13px;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #E5E5EA;
    background: var(--line);
}
.ios-cell:last-child:after { display: none; }

.ios-cell-label { float: left; color: #8E8E93; color: var(--text-2); }
.ios-cell-value {
    float: right;
    color: #000000;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.sheet-cancel {
    display: block;
    width: 100%;
    height: 52px;
    margin-top: 8px;
    background: #FFFFFF;
    background: var(--surface);
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    line-height: 52px;
    text-align: center;
    color: #007AFF;
    color: var(--accent);
}
.sheet-cancel:active { background: #F7F7F8; background: var(--fill); }

/* ---------- 11. 按钮 ---------- */
.btn {
    display: inline-block;
    height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 600;
    line-height: 34px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -webkit-transition: background .15s, color .15s, border-color .15s;
    transition: background .15s, color .15s, border-color .15s;
}

.btn-primary {
    background: #007AFF;
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: #0062CC; background: var(--accent-press); }
.btn-primary:active { opacity: .85; }

.btn-plain {
    background: #FFFFFF;
    background: var(--surface);
    color: #000000;
    color: var(--text);
    border-color: #C8C8CC;
    border-color: var(--line-strong);
}
.btn-plain:hover { background: #F7F7F8; background: var(--fill); }

.btn-danger {
    background: transparent;
    color: #FF3B30;
    color: var(--danger);
    border-color: transparent;
}
.btn-danger:hover { background: rgba(255, 59, 48, .1); }

.btn-sm {
    height: 30px;
    padding: 0 11px;
    font-size: 13px;
    line-height: 28px;
    border-radius: 8px;
}
.btn-block {
    display: block;
    width: 100%;
    height: 44px;
    margin-top: 14px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 42px;
}

/* ---------- 12. PC 端：悬浮面板 + 侧边栏 ----------
   外壳先用 table 布局（所有内核都认，iOS 5 的 iPad 也能拿到两栏），
   再在 @supports (display: flex) 里升级成 flex + 吸顶侧边栏 + 卡片网格。
   不支持 flex 的旧浏览器：侧边栏照样在，列表退化成通栏行（就是手机的样子），
   不会出现「窄卡片挤成一列」这种半坏状态。 */
@media screen and (min-width: 768px) {
    body {
        padding: 24px;
        background: #F0F0F0;
        background: var(--page);
    }

    .shell {
        display: table;
        table-layout: fixed;
        width: 100%;
        max-width: 1200px;
        margin: 0 auto;
        background: #FFFFFF;
        background: var(--surface);
        border-radius: 14px;
        -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
        box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
        box-shadow: var(--shadow);
    }

    .topbar { display: none; }

    .sidebar {
        display: table-cell;
        width: 232px;
        padding: 20px 14px 16px;
        vertical-align: top;
        background: #FFFFFF;
        background: var(--surface);
        border-right: 1px solid #E5E5EA;
        border-right-color: var(--line);
        border-radius: 14px 0 0 14px;
    }

    .side-foot { margin-top: 36px; }

    .main {
        display: table-cell;
        vertical-align: top;
        background: #EFEFF4;
        background: var(--bg);
        border-radius: 0 14px 14px 0;
    }

    .content { padding: 0 26px 34px; }

    /* 一行搞定：左边「全部应用 6 款」，右边搜索框。
       搜索框绝对定位靠右，旧浏览器不支持 flex 也不会错位 */
    .store-head {
        position: relative;
        padding: 20px 0 15px;
    }
    .store-head .toolbar {
        position: absolute;
        right: 0;
        top: 16px;
        width: 300px;
        padding: 0;
    }
    .store-head .section-head { padding: 4px 320px 0 0; }
    .store-head .section-count { float: none; margin-left: 10px; }

    .segments { display: none; }

    .section-title {
        float: none;
        display: inline;
        font-size: 16px;
        font-weight: 600;
        color: #000000;
        color: var(--text);
    }

    .section-count { font-size: 13px; }

    .page-foot { padding: 28px 0 0; }

    /* 弹层在 PC 上变成居中对话框 */
    .sheet-mask:before { vertical-align: middle; }
    .sheet {
        width: 100%;
        max-width: 372px;
        vertical-align: middle;
    }
    .sheet-body { padding: 20px 18px 18px; }
    .sheet-cancel {
        height: 44px;
        margin-top: 10px;
        font-size: 15px;
        line-height: 44px;
        border-radius: 12px;
    }

    /* ---------- 以下是「现代浏览器加分项」 ---------- */
    @supports (display: flex) {
        .shell {
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-align: stretch;
            -webkit-align-items: stretch;
            align-items: stretch;
            min-height: 600px;
            min-height: calc(100vh - 48px);
        }

        .sidebar {
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-flex-direction: column;
            flex-direction: column;
            -webkit-box-flex: 0;
            -webkit-flex: 0 0 232px;
            flex: 0 0 232px;
            position: relative;
            position: -webkit-sticky;
            position: sticky;
            top: 24px;
            height: 600px;
            height: calc(100vh - 48px);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .side-foot { margin-top: auto; }

        .main {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            min-width: 0;
            overflow: hidden;
        }

        /* 列表 → 卡片网格（不用 grid，旧一点的内核也能拿到卡片） */
        .app-list {
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-lines: multiple;
            -webkit-flex-wrap: wrap;
            flex-wrap: wrap;
            -webkit-box-pack: justify;
            -webkit-justify-content: space-between;
            justify-content: space-between;
            margin-bottom: -14px;
            background: none;
        }

        .app-item {
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-flex-direction: column;
            flex-direction: column;
            -webkit-box-align: stretch;
            -webkit-align-items: stretch;
            align-items: stretch;
            width: 48.8%;
            margin-bottom: 14px;
            padding: 16px;
            background: #FFFFFF;
            background: var(--surface);
            border: 1px solid #E5E5EA;
            border-color: var(--line);
            border-radius: 12px;
            border-radius: var(--radius);
            -webkit-transition: -webkit-transform .18s ease, -webkit-box-shadow .18s ease, border-color .18s ease;
            transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
        }
        .app-item:after { display: none; }
        .app-item:active { background: #FFFFFF; background: var(--surface); }

        .app-icon {
            width: 56px;
            height: 56px;
            margin-right: 0;
            margin-bottom: 12px;
            border-radius: 14px;
        }
        .app-icon .ph { font-size: 23px; line-height: 56px; }

        .app-name { font-size: 15.5px; font-weight: 600; }
        .app-meta { margin-top: 4px; font-size: 12.5px; }

        .app-get {
            width: 100%;
            min-width: 0;
            height: 33px;
            margin-left: 0;
            margin-top: 14px;
            border-radius: 8px;
            font-size: 13.5px;
            line-height: 33px;
        }

        .empty {
            border: 1px solid #E5E5EA;
            border-color: var(--line);
            border-radius: 12px;
            border-radius: var(--radius);
            background: #FFFFFF;
            background: var(--surface);
        }
    }
}

/* 宽屏排三列（内容区约 916px，每张卡 300px 上下） */
@media screen and (min-width: 1024px) {
    @supports (display: flex) {
        .app-item { width: 32.2%; }
    }
}

@media screen and (min-width: 768px) and (hover: hover) {
    .app-item:hover {
        border-color: transparent;
        -webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, .10);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .10);
        -webkit-transform: translateY(-2px);
        transform: translateY(-2px);
    }
    [data-theme="dark"] .app-item:hover { -webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, .55); box-shadow: 0 8px 24px rgba(0, 0, 0, .55); }
    .app-get:hover { background: #007AFF; background: var(--accent); color: #fff; }
}

/* ==========================================================================
   后台管理（沿用同一套色板，只是把列表行换成可操作的行）
   ========================================================================== */
.admin-body { background: #EFEFF4; background: var(--bg); }

.admin-head {
    position: relative;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 30;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    height: 52px;
    padding: 0 15px;
    background: #FFFFFF;
    background: var(--chrome);
    border-bottom: 1px solid #C8C8CC;
    border-bottom-color: var(--line-strong);
}

.brand-mini {
    display: inline-block;
    margin-right: 12px;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 26px;
    white-space: nowrap;
    vertical-align: middle;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
}
.brand-mini img {
    display: inline-block;
    width: 26px;
    height: 26px;
    margin-right: 8px;
    border-radius: 5px;
    vertical-align: middle;
}
.brand-mini span { vertical-align: middle; }

/* 导航靠右：旧 flex 用 box-pack，新的用 justify-content */
.admin-nav {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: end;
    -webkit-justify-content: flex-end;
    justify-content: flex-end;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
}

.admin-nav a {
    margin-left: 2px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    color: #8E8E93;
    color: var(--text-2);
    white-space: nowrap;
}
.admin-nav a:hover { background: #F7F7F8; background: var(--fill); color: #000000; color: var(--text); }
.admin-nav a.is-active {
    background: rgba(0, 122, 255, .10);
    background: var(--accent-soft);
    color: #007AFF;
    color: var(--accent);
    font-weight: 500;
}
.admin-nav a.is-danger { color: #FF3B30; color: var(--danger); }
.admin-nav .icon-btn { margin-left: 2px; }

.admin-main {
    max-width: 940px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.admin-bar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 14px 15px;
}
.admin-bar .search-field {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    max-width: 320px;
    margin-right: 10px;
}
.admin-bar > .btn {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
}

.admin-list {
    background: #FFFFFF;
    background: var(--surface);
}

.admin-row {
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #E5E5EA;
    border-bottom-color: var(--line);
}
.admin-row:last-child { border-bottom: 0; }

.admin-row .app-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
}
.admin-row .app-icon .ph { font-size: 19px; line-height: 46px; }

.admin-info {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-width: 0;
}

.admin-name {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
}
.admin-name > span:first-child {
    /* 不放大：让后面的「已隐藏」标签紧贴应用名；空间不够时再收缩出省略号 */
    -webkit-box-flex: 0;
    -webkit-flex: 0 1 auto;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
    background: #F7F7F8;
    background: var(--fill);
    color: #8E8E93;
    color: var(--text-2);
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
}
.tag-off { background: rgba(255, 149, 0, .14); color: #FF9500; }

.admin-meta {
    margin-top: 3px;
    font-size: 12.5px;
    color: #8E8E93;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-actions {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    margin-left: 12px;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
}

.row-form {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
}

/* 用相邻兄弟选择器代替 gap */
.admin-actions > * + * { margin-left: 6px; }
.row-form > * + * { margin-left: 6px; }

.btn-icon {
    position: relative;
    display: block;
    width: 30px;
    height: 30px;
    border: 1px solid #C8C8CC;
    border-color: var(--line-strong);
    border-radius: 8px;
    background: #FFFFFF;
    background: var(--surface);
    color: #8E8E93;
    color: var(--text-2);
}
.btn-icon:hover { background: #F7F7F8; background: var(--fill); color: #000000; color: var(--text); }
.btn-icon svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
}
.btn-icon:disabled { opacity: .35; cursor: default; }

/* 提示条 */
.notice {
    margin: 14px 15px 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    background: rgba(0, 122, 255, .10);
    background: var(--accent-soft);
    color: #007AFF;
    color: var(--accent);
}
.notice.is-err {
    background: rgba(255, 59, 48, .1);
    color: #FF3B30;
    color: var(--danger);
}

/* 表单 */
.fieldset {
    margin: 0 15px 14px;
    background: #FFFFFF;
    background: var(--surface);
    border: 1px solid #E5E5EA;
    border-color: var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.fieldset-title {
    padding: 13px 15px 0;
    font-size: 13px;
    color: #8E8E93;
    color: var(--text-2);
}
.fieldset-title + .field { border-top: 0; }

.field {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    padding: 11px 15px;
    border-top: 1px solid #E5E5EA;
    border-top-color: var(--line);
}

.field-label {
    width: 84px;
    margin-right: 12px;
    padding-top: 7px;
    font-size: 14.5px;
    color: #8E8E93;
    color: var(--text-2);
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
}

.field-body {
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    min-width: 0;
}

.input {
    display: block;
    width: 100%;
    height: 36px;
    padding: 0 10px;
    background: #F7F7F8;
    background: var(--fill);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 16px;          /* 防止 iOS 聚焦放大 */
    line-height: 34px;
    color: #000000;
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
    -webkit-transition: border-color .15s, background .15s;
    transition: border-color .15s, background .15s;
}
.input:focus {
    border-color: #007AFF;
    border-color: var(--accent);
    background: #FFFFFF;
    background: var(--surface);
}
.input-sm { height: 32px; font-size: 14px; line-height: 30px; }

textarea.input {
    height: auto;
    min-height: 72px;
    padding: 8px 10px;
    line-height: 1.5;
    resize: vertical;
}

.field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #8E8E93;
    color: var(--text-2);
    line-height: 1.5;
}

.field-actions { margin-bottom: 10px; }
.field-actions .btn { margin-right: 8px; vertical-align: middle; }
.field-actions .field-hint { display: inline-block; margin: 0; vertical-align: middle; }

/* 图标预览 */
.icon-preview {
    overflow: hidden;
    margin-bottom: 10px;
}
.icon-preview .app-icon {
    float: left;
    width: 56px;
    height: 56px;
    margin-right: 12px;
    border-radius: 13px;
}
.icon-preview .app-icon .ph { font-size: 22px; line-height: 56px; }
.icon-preview .radio { line-height: 56px; }

.radio-row { padding-top: 7px; }

.radio {
    display: inline-block;
    margin-right: 16px;
    font-size: 14.5px;
    line-height: 1.45;
    cursor: pointer;
}
.radio input {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: -2px;
    accent-color: #007AFF;
}

.form-foot { padding: 4px 15px 0; }
.form-foot .btn { margin-right: 10px; }

/* 登录页 */
.login-page {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    min-height: 480px;
    min-height: 100vh;
    padding: 24px;
    background: #EFEFF4;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 336px;
    padding: 28px 22px 22px;
    background: #FFFFFF;
    background: var(--surface);
    border-radius: 16px;
    -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
    box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
    box-shadow: var(--shadow);
}

.login-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    border-radius: 12px;
}

.login-title {
    font-size: 19px;
    font-weight: 600;
    text-align: center;
}

.login-sub {
    margin-top: 4px;
    margin-bottom: 20px;
    font-size: 12.5px;
    color: #8E8E93;
    color: var(--text-2);
    text-align: center;
}

.login-field { margin-bottom: 10px; }
.login-field .input { height: 42px; line-height: 40px; padding: 0 12px; }

.login-foot {
    margin-top: 18px;
    font-size: 11.5px;
    color: #C7C7CC;
    color: var(--text-3);
    text-align: center;
}

/* 安装向导 */
.setup-page {
    min-height: 100%;
    padding: 30px 18px 40px;
    background: #EFEFF4;
    background: var(--bg);
}
.setup-card {
    max-width: 520px;
    margin: 0 auto;
    padding-bottom: 20px;
    background: #FFFFFF;
    background: var(--surface);
    border-radius: 16px;
    -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
    box-shadow: 0 2px 20px rgba(0, 0, 0, .08);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.setup-head { padding: 26px 22px 14px; text-align: center; }
.setup-head img { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 11px; }
.setup-head h1 { font-size: 20px; font-weight: 600; }
.setup-head p {
    margin-top: 6px;
    font-size: 13px;
    color: #8E8E93;
    color: var(--text-2);
    line-height: 1.6;
}
.setup-card .fieldset { margin-left: 18px; margin-right: 18px; }
.setup-card .form-foot { padding-left: 18px; padding-right: 18px; }
.setup-ok { padding: 16px 22px 4px; text-align: center; }
.setup-ok .tick {
    position: relative;
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 27px;
    background: rgba(52, 199, 89, .14);
    color: #34C759;
    color: var(--green);
}
.setup-ok .tick svg {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
}
.setup-ok h2 { margin-bottom: 8px; font-size: 17px; font-weight: 600; }
.setup-ok p {
    font-size: 13.5px;
    color: #8E8E93;
    color: var(--text-2);
    line-height: 1.7;
}

/* ---------- 13. 小屏微调 ---------- */
@media screen and (max-width: 560px) {
    .admin-head { padding: 0 10px; }
    .brand-mini { margin-right: 6px; }
    .brand-mini span { display: none; }   /* 窄屏只留 logo，给右侧按钮腾地方 */
    .admin-nav a { padding: 6px 8px; font-size: 13px; }

    .field {
        -webkit-box-orient: vertical;
        -webkit-flex-direction: column;
        flex-direction: column;
        -webkit-box-align: stretch;
        -webkit-align-items: stretch;
        align-items: stretch;
    }
    .field-label { width: auto; margin: 0 0 6px; padding-top: 0; font-size: 13px; }
    .field-body { width: 100%; }
}

/* 后台行：窄屏不用 flex 换行（旧内核会挤掉应用名），
   改成 block + 图标左浮动 + 操作按钮另起一行 */
@media screen and (max-width: 720px) {
    .admin-row {
        display: block;
        padding-top: 11px;
        padding-bottom: 11px;
        overflow: hidden;
    }
    .admin-row .app-icon { float: left; margin-right: 12px; }
    .admin-info { overflow: hidden; }

    .admin-actions {
        clear: both;
        width: 100%;
        margin: 8px 0 0;
        -webkit-box-pack: end;
        -webkit-justify-content: flex-end;
        justify-content: flex-end;
    }
}

/* 桌面端详情弹窗：右上角关闭按钮替代底部「取消」，看起来更像对话框 */
.sheet-close { display: none; }

@media screen and (min-width: 768px) {
    .sheet-close {
        display: block;
        position: absolute;
        top: 6px;
        right: 6px;
        z-index: 2;
        width: 30px;
        height: 30px;
        border-radius: 15px;
        color: #8E8E93;
        color: var(--text-2);
    }
    .sheet-close:hover { background: #F7F7F8; background: var(--fill); color: #000000; color: var(--text); }
    .sheet-close svg {
        position: absolute;
        left: 50%;
        top: 50%;
        width: 13px;
        height: 13px;
        margin: -6px 0 0 -6px;
    }
    .sheet-cancel { display: none; }
}

/* 自定义文件选择按钮（原生 input 太丑，这里把它铺满按钮并透明） */
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    font-size: 100px;
}
