/* ==========================================================================
   css/index/app.css
   用途：用户端页面组件（卡片 / 标签页 / 列表 / 表单 / 徽标 / toast）
   （由 Blade 内联样式抽取，M12 静态资源分离，2026-09-17）
   ========================================================================== */

.page { padding:34px 0 10px; }
.page h1 { font-size:22px; margin:0 0 6px; }
.page .sub { color:var(--muted); font-size:13px; margin-bottom:20px; }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px; }
.card h3 { margin:0 0 12px; font-size:15px; }
.tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.tabs a { padding:7px 14px; border-radius:999px; border:1px solid var(--line); font-size:13px; color:var(--muted); }
.tabs a.active { background:var(--primary); border-color:var(--primary); color:#fff; }
table.list { width:100%; border-collapse:collapse; font-size:13px; }
table.list th, table.list td { text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); vertical-align:middle; }
table.list th { color:var(--muted); font-weight:500; }
.field { margin-bottom:14px; }
.field label { display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
.field input, .field select, .field textarea {
    width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--line);
    background:var(--bg-soft); color:var(--text); font-size:14px; font-family:inherit; }
.field .hint { font-size:12px; color:var(--muted); margin-top:6px; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.row > * { flex:1 1 200px; }
.badge { display:inline-block; padding:2px 9px; border-radius:999px; font-size:12px;
    border:1px solid var(--line); color:var(--muted); }
.badge.ok { color:#7ee2a8; border-color:rgba(34,197,94,.45); }
.badge.warn { color:#f7c86b; border-color:rgba(245,158,11,.45); }
.badge.err { color:#ff9b9b; border-color:rgba(239,68,68,.45); }
.muted { color:var(--muted); }
.amount { font-size:20px; font-weight:700; }
/* M40：空态统一样式（列表无数据时居中显示） */
.empty { color:var(--muted); font-size:13px; padding:18px 0; text-align:center; }
/* M94：toast 层级提到 90 —— 高于登录/注册弹窗（.auth-modal z-index:80）与各类抽屉/遮罩，
   否则在弹窗内提交出错时，错误提示会被遮罩盖住（用户反馈） */
#toast { position:fixed; right:20px; bottom:24px; z-index:90; display:flex; flex-direction:column; gap:8px; }
#toast div { background:#1d2742; border:1px solid var(--line); border-left:3px solid var(--primary);
    border-radius:10px; padding:10px 14px; font-size:13px; max-width:320px; box-shadow:0 10px 24px rgba(0,0,0,.35); }
#toast div.ok { border-left-color:var(--success); }
#toast div.err { border-left-color:#ef4444; }
.kv { display:flex; justify-content:space-between; padding:7px 0; border-bottom:1px dashed var(--line); font-size:13px; }
.kv:last-child { border-bottom:0; }
.kv span:first-child { color:var(--muted); }


/* M27 用户中心列表与详情
   —— 列表：表格铺满宽度、表头与内容同左对齐、窄屏可横向滚动（.table-wrap）
   —— 详情：与列表分屏显示（同一时刻只显示一个），返回按钮 .list-back
   —— 消息行：.notice-item（标题左 / 时间右，避免 .row>* 的 200px 基准导致错位） */
.table-wrap { width: 100%; overflow-x: auto; }

.pager-bar { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

.pager-bar .muted { flex: 0 0 auto; }

.list-back { margin-bottom: 12px; }

table.list { width: 100%; }

table.list th { white-space: nowrap; }

table.list td { vertical-align: middle; }

table.list td.ops, table.list th:last-child { white-space: nowrap; }

.notice-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.notice-item .notice-head { display: flex; align-items: center; gap: 10px; }

.notice-item .notice-title { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 14px; }

.notice-item .notice-time { flex: 0 0 auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.notice-item .notice-body { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }


/* M28 用户中心列表宽度与纵向对齐
   —— 容器：用户中心页面（.page.container）由 base.css 的 1180px 放宽到 1320px，列表更接近铺满；
   —— 表格：宽度 100%，表头与单元格统一纵向居中（商品名两行时金额/状态/时间/操作仍居中）
   —— 说明：M12 抽取样式中 th/td 的顶对齐（top）已同时改为 middle，此处再显式声明一次防空漏 */
.page.container { max-width: 1320px; width: 100%; }

table.list { width: 100%; }

table.list th, table.list td { vertical-align: middle; }

table.list th { white-space: nowrap; }

table.list tbody tr:last-child td { border-bottom: 0; }

/* M29 页头语言 / 货币切换器
   —— 复用 .pill 外观，内部 select 透明无边框，保持页头视觉一致；
   —— 值变更逻辑见 /static/js/switcher.js（语言跳前缀、货币写 Cookie 后刷新）

   M116 样式优化：
     ① 原生下拉箭头（各浏览器深色主题下为灰白三角）改为**自绘 chevron**（SVG data URI，hover 变亮）；
     ② 胶囊改为「等高 + 内联 flex 居中」，与页头其它控件（.btn / 图标按钮）视觉对齐；
     ③ 补齐 hover / :focus-within 反馈（原实现只有 outline:none，键盘聚焦无任何提示）；
     ④ 去掉 overflow:hidden —— 它会裁掉聚焦描边（聚焦环画在胶囊外侧）；
     ⑤ 语言 / 货币各自设最小宽度，避免「简体中文」「￥ 人民币」被挤成截断 */
.pill.switcher {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.pill.switcher:hover { border-color: rgba(93, 141, 255, .55); background: rgba(255, 255, 255, .07); }

/* 键盘 Tab 聚焦时给出可见反馈（替代被移除的原生 outline） */
.pill.switcher:focus-within {
    border-color: var(--mainColor);
    box-shadow: 0 0 0 3px rgba(61, 123, 255, .22);
}

.pill.switcher select {
    height: 100%;
    background-color: transparent;
    border: 0;
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    line-height: 1.2;
    /* 右侧留出自绘箭头的位置 */
    padding: 0 26px 0 12px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* M116 补充：让浏览器自绘的原生弹层（下拉列表 / 滚动条）也使用深色外观，
       规避 Safari 等忽略 option 样式时出现「亮白列表」的问题 */
    color-scheme: dark;
    text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239aa6c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    background-size: 10px 6px;
}

.pill.switcher:hover select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23cfe0ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* 原生下拉列表项（M116 补充）：改为**深色主题**（原先浅底深字在深色页头里过于突兀）
   浏览器支持说明：
     · `option` 的底色 / 字色在 **Chromium / Firefox** 生效；
     · **Safari（macOS / iOS）会忽略** option 样式 —— 故在 select 上同时声明 `color-scheme: dark`
       （见上方 select 规则），让浏览器**自绘的弹层**（含弹层滚动条）也走深色外观。 */
.pill.switcher select option {
    background-color: #10161f;
    color: var(--text);
}

/* 当前选中项：加深并提亮文字，作为弹层内的「已选」标识 */
.pill.switcher select option:checked {
    background-color: #22375e;
    color: #ffffff;
}

/* 语言名（简体中文 / English / Русский）与货币（￥ 人民币）各自的最小宽度 */
.pill.switcher.switcher-lang select { min-width: 96px; }
.pill.switcher.switcher-currency select { min-width: 108px; }

@media (max-width: 760px) {
    .pill.switcher { height: 32px; }
    .pill.switcher select { font-size: 12px; padding: 0 24px 0 10px; background-size: 9px 5px; }
}

/* ---------------------------------------------------------------------------
   M40：支付页（/payment）——支付方式 / 支付场景 / 二维码
   --------------------------------------------------------------------------- */
.pay-channels { display: flex; flex-wrap: wrap; gap: 10px; }
.pay-channels .channel-item { display: flex; align-items: center; gap: 8px; cursor: pointer;
    background: transparent; color: var(--text); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.pay-channels .channel-item img { width: 20px; height: 20px; display: block; }
.pay-channels .channel-item.active { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(61,123,255,.4) inset; }
.pay-types { display: flex; flex-wrap: wrap; gap: 8px; }
.pay-types .pay-type { cursor: pointer; background: transparent; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px; }
.pay-types .pay-type.active { color: #fff; border-color: var(--primary); background: rgba(61,123,255,.18); }
.pay-qr { display: flex; justify-content: center; margin: 6px 0 12px; }
.pay-qr img { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 8px; }
.pay-qr-link { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
#qr-link { font-size: 12px; color: var(--muted); }
/* M43：微信支付本地 mock 操作区（仅测试环境渲染） */
.mock-panel { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; }
.mock-panel h4 { color: var(--muted); font-size: 14px; }
/* ---------------------------------------------------------------------------
   M45：支付页倒计时（时:分:秒）与二维码弹窗
   M46：倒计时美化（时钟图标 + 背景框）、订单号复制、二维码图片
   --------------------------------------------------------------------------- */
#order-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-line { display: inline-flex; align-items: center; gap: 8px; }
.order-no { color: #fff; font-weight: 600; letter-spacing: .3px; }
.copy-btn { background: transparent; border: 1px solid var(--line); color: var(--muted);
    border-radius: 6px; padding: 2px 9px; font-size: 12px; }
.copy-btn:hover { color: #fff; border-color: var(--primary); }
.pay-countdown { display: inline-flex; align-items: center; gap: 7px; margin-left: 4px; padding: 4px 13px;
    background: linear-gradient(180deg, rgba(61,123,255,.22), rgba(61,123,255,.10));
    border: 1px solid rgba(61,123,255,.38); border-radius: 999px;
    font-weight: 700; color: #fff; letter-spacing: .6px; font-variant-numeric: tabular-nums; }
.pay-countdown .cd-icon { width: 15px; height: 15px; flex: 0 0 15px; color: #9dc0ff; }
.pay-modal { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 60;
    align-items: center; justify-content: center; }
.pay-modal.open { display: flex; }
.pay-modal-mask { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(6,10,20,.72); }
.pay-modal-box { position: relative; width: min(420px, calc(100vw - 40px)); background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.pay-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pay-modal-head h3 { margin: 0; font-size: 16px; }
.pay-modal-close { background: transparent; border: 0; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.pay-modal-body { text-align: center; }
.pay-modal-body .field { text-align: left; }
/* M46：二维码图片与链接复制行 */
.pay-qr img#qr-img { width: 240px; height: 240px; }
.qr-link-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.qr-link-row input { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--muted);
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }

/* ---------------------------------------------------------------------------
   M69 / M70：列表移动端适配（通用「卡片列表」.list-cards）
   —— 结构：表格型列表在 ≤900px 下转为「卡片 + 标签 / 值」列表（表头隐藏），
           标签取自 td 上的 data-label（由页面 JS 按当前语言注入），DOM 与会话逻辑不变
   —— 覆盖：订单（M69）、券包 / 钱包 / 充值账号 / 兑换记录 / 佣金 / 提现 / 售后（M70）
   —— 用法：<table class="list list-cards">…</table> 且每列 td 带 data-label="列名"
   —— 空态：必须渲染为合法表格行 <tr><td class="empty" colspan="N">；
           在 <tbody> 内放 <div> 会被浏览器 foster-parent 移动到表格之外，CSS 无法居中
   —— 说明：`table.list td` 的 text-align:left 特异性为 (0,0,1,2)，
           故空态需写 `table.list td.empty` 才能让 text-align:center 生效
   --------------------------------------------------------------------------- */
table.list td.empty {
    text-align: center;
    vertical-align: middle;
    height: 140px;
}

/* M70：内联 grid 抽为工具类
   —— 内联 style 的优先级高于样式表，媒体查询无法覆盖，故响应式布局必须使用类名 */
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-2-wide-left { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.grid-2-wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

@media (max-width: 900px) {
    /* 筛选项 / 状态标签：横向滚动，避免换行占满多行 */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .tabs a { flex: 0 0 auto; }
    #status-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    #status-tabs a { flex: 0 0 auto; }

    /* 内联 grid 工具类：窄屏统一单列 */
    .grid-2,
    .grid-2-wide-left,
    .grid-2-wide-right,
    .grid-auto { grid-template-columns: minmax(0, 1fr); }

    /* 卡片列表：表格 → 卡片（标签 / 值） */
    .table-wrap { overflow-x: visible; }
    .list-cards thead { display: none; }
    .list-cards,
    .list-cards tbody,
    .list-cards tr,
    .list-cards td { display: block; width: 100%; }
    .list-cards tr {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--bg-soft);
        padding: 10px 12px;
        margin-bottom: 10px;
    }
    .list-cards td {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px 10px;
        border-bottom: 0;
        padding: 5px 0;
        white-space: normal;
        word-break: break-word;
    }
    .list-cards td::before {
        content: attr(data-label);
        flex: 0 0 72px;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.75;
    }
    /* 未声明 data-label 的单元格不渲染标签（避免出现空占位） */
    .list-cards td:not([data-label])::before { content: none; }
    .list-cards td.ops { white-space: normal; }
    .list-cards td.ops .link { white-space: nowrap; line-height: 1.9; }
    /* 空态行不参与「标签 / 值」布局 */
    .list-cards td.empty { display: block; height: auto; padding: 22px 0; text-align: center; }
    .list-cards td.empty::before { content: none; }
    .list-cards tbody tr:last-child td { border-bottom: 0; }

    /* 分页条：窄屏换行不挤压 */
    .pager-bar { flex-wrap: wrap; }

    /* 键值对与详情操作按钮：窄屏可换行 */
    .kv { gap: 10px; word-break: break-word; }
    #order-detail .kv { gap: 10px; word-break: break-word; }
    #order-detail .row > * { flex: 1 1 auto; }

    /* 站内消息：标题与时间在窄屏可换行（避免标题被挤成竖排） */
    .notice-item .notice-head { flex-wrap: wrap; }
    .notice-item .notice-time { margin-left: auto; }
}

/* ---------------------------------------------------------------------------
   M73：用户中心「左右结构」（左侧菜单 + 右侧内容）
   —— 桌面：两栏 grid（212px 菜单 + 自适应内容），菜单竖排并吸顶随页面滚动
   —— 手机（≤900px）：**不显示用户菜单**（页头账户抽屉已提供同样入口），内容单列铺满
   --------------------------------------------------------------------------- */
.uc-layout {
    display: grid;
    grid-template-columns: 212px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
    margin-top: 10px;
}

.uc-side {
    position: sticky;
    top: 74px;
    min-width: 0;
}

/* 菜单：竖排列表（覆盖 .tabs 的横向胶囊样式） */
.uc-side .tabs {
    flex-direction: column;
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    margin-bottom: 0;
}

.uc-side .tabs a {
    display: block;
    width: 100%;
    padding: 9px 14px;
    border-radius: 10px;
    white-space: nowrap;
}

.uc-main { min-width: 0; }

@media (max-width: 900px) {
    .uc-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }

    /* 手机端不显示用户菜单 */
    .uc-side { display: none; }
}

/* ---------------------------------------------------------------------------
   M92：充值信息「图片」字段（用户中心订单详情等只读展示）→ 缩略图
   点击图片在新窗口查看原图（.acc-img 为 <a> 包裹 <img>）。
   --------------------------------------------------------------------------- */
.acc-img { display: inline-block; }
.acc-img img { display: block; width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------------------------------------------------------------------------
   M95：推广合作页拆分为多页（概览 / 推广列表 / 订单列表 / 提现记录）
   —— 复用用户中心的左右结构（.uc-layout / .uc-side / .uc-main）
   —— 窄屏左栏隐藏（M73 规则），故正文顶部再放一份横向导航 #af-mobile-nav；
      宽屏隐藏该副本，避免与左栏重复。
   --------------------------------------------------------------------------- */
@media (min-width: 901px) {
    #af-mobile-nav { display: none; }
}

#af-mobile-nav { margin-bottom: 14px; }

/* 空态与说明文字在推广各页统一留白 */
.af-tip { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }

/* M96：卡片标题与右侧操作按钮「左右分布」（如「提现记录」+「申请提现」） */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-head h3 { margin: 0; }

/* ---------------------------------------------------------------------------
   M105：用户端订单详情「分区 + 描述行」
   —— 不再使用 grid card；参考管理端订单详情：分区标题 + 「左标签 / 右值」描述行
   --------------------------------------------------------------------------- */
.desc-sec { margin: 0 0 16px; }

.desc-sec-title {
    margin: 0 0 8px;
    padding-left: 9px;
    border-left: 3px solid var(--primary);
    font-size: 14px;
    font-weight: 600;
}

.desc {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.desc-row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 9px 12px;
    border-bottom: 1px dashed var(--line);
    font-size: 13px;
}

.desc-row:last-child { border-bottom: 0; }

.desc-k { color: var(--muted); }

.desc-v { min-width: 0; word-break: break-word; }

.desc-empty { padding: 9px 12px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------------------
   M106：字段类分区改为「一行 3~4 列」（与管理端订单详情同口径）
   —— 商品与金额 / 支付信息 / 充值信息等**字段类**分区加 `.desc-grid`；
      交付进度 / 时间线等**记录类**分区不加，保持整行铺开。
   --------------------------------------------------------------------------- */
.desc.desc-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 18px;
    padding: 4px 12px;
}

/* 网格内每格为「标签 + 值」内联排布（不再占满整行，仍保留虚线分隔便于扫读） */
.desc.desc-grid .desc-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    grid-template-columns: none;
}

.desc.desc-grid .desc-k { flex: 0 0 auto; min-width: 76px; }

.desc.desc-grid .desc-v { flex: 1 1 auto; min-width: 0; }

/* 宽屏 4 列 → 中屏 3 列 → 平板 2 列 → 手机 1 列 */
@media (max-width: 1500px) {
    .desc.desc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
    .desc.desc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 窄屏：标签与值改为上下两行，避免标签列挤压内容 */
@media (max-width: 720px) {
    .desc-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .desc.desc-grid { grid-template-columns: minmax(0, 1fr); }
    .desc.desc-grid .desc-row { flex-wrap: wrap; }
}

/* 订单详情时间线（并入分区体系后统一字号） */
#order-timeline { font-size: 13px; }
