/* ==========================================================
   客户自助门户样式（移动端优先）
   ========================================================== */
body.portal { background: #f5f7fb; display: flex; flex-direction: column; min-height: 100vh; }

.p-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 18px; }

.p-top {
    background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.p-top .p-wrap { display: flex; align-items: center; gap: 18px; height: 62px; flex-wrap: wrap; }
.p-brand { display: flex; align-items: center; gap: 10px; }
.p-logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, #3CAFFF, #1E7FFF);
    color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.p-name { font-size: 15px; font-weight: 600; line-height: 1.25; }
.p-slogan { font-size: 11px; color: var(--text-muted); }

.p-nav { display: flex; gap: 4px; margin-left: 10px; flex: 1; flex-wrap: wrap; }
.p-nav a {
    padding: 7px 13px; border-radius: 8px; font-size: 13.5px; color: #4b5563;
    display: inline-flex; align-items: center; gap: 6px;
}
.p-nav a:hover { background: #F7F8FA; text-decoration: none; }
.p-nav a.active { background: #E8F3FF; color: #0E6FD1; font-weight: 500; }
.p-nav a > svg { opacity: .9; }

.p-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.p-iccid { font-family: Consolas, Menlo, monospace; color: var(--text-muted); font-size: 12.5px; }
.p-out { color: var(--text-muted); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.p-out:hover { color: var(--danger); }

.p-body { flex: 1; padding: 22px 0 40px; }

.p-foot {
    border-top: 1px solid var(--border); background: #fff;
    padding: 18px 0; font-size: 12.5px; color: var(--text-muted);
}

/* ---------- 卡片 ---------- */
.p-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.p-card .hd {
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.p-card .hd h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.p-card .hd h3 > svg { color: #1E9FFF; }
.p-card .hd .sub { font-size: 12px; color: var(--text-muted); }
.p-card .bd { padding: 18px; }

/* ---------- 流量主视觉 ---------- */
.flow-hero {
    background: linear-gradient(135deg, #1E9FFF 0%, #0E8AEB 55%, #0E6FD1 100%);
    border-radius: 14px; padding: 26px 28px; color: #fff; margin-bottom: 16px;
}
.flow-hero .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.flow-hero .iccid { font-family: Consolas, Menlo, monospace; font-size: 13px; opacity: .9; letter-spacing: .5px; }
.flow-hero .big { font-size: 34px; font-weight: 700; line-height: 1.15; margin-top: 6px; }
.flow-hero .big small { font-size: 15px; font-weight: 500; opacity: .85; margin-left: 4px; }
.flow-hero .lbl { font-size: 12.5px; opacity: .85; }
.flow-hero .bar { height: 10px; background: rgba(255,255,255,.28); border-radius: 8px; overflow: hidden; margin-top: 16px; }
.flow-hero .bar > i {
    display: block; height: 100%; border-radius: 8px;
    background: linear-gradient(90deg, #fff, #CDE7FF);
    transition: width .4s;
}
.flow-hero .nums { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 8px; opacity: .92; }
.flow-hero .status-pill {
    background: rgba(255,255,255,.2); padding: 5px 14px; border-radius: 20px; font-size: 13px;
}

/* ---------- 信息网格 ---------- */
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.p-item { background: #F7F8FA; border-radius: 9px; padding: 12px 14px; }
.p-item .k { font-size: 12px; color: var(--text-muted); }
.p-item .v { font-size: 15px; font-weight: 600; margin-top: 3px; word-break: break-all; }

/* ---------- 套餐卡片 ---------- */
.pkgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pkg {
    border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 18px;
    display: flex; flex-direction: column; transition: .18s; position: relative;
}
.pkg:hover { border-color: #7CC9FF; box-shadow: 0 6px 20px rgba(30,159,255,.13); }
.pkg.cur { border-color: #1E9FFF; box-shadow: 0 0 0 3px rgba(30,159,255,.14); }
.pkg .tag {
    position: absolute; top: -9px; right: 12px; background: #1E9FFF; color: #fff;
    font-size: 11px; padding: 2px 9px; border-radius: 10px;
}
.pkg .nm { font-size: 15.5px; font-weight: 600; }
.pkg .flow { font-size: 22px; font-weight: 700; color: var(--primary); margin: 8px 0 2px; }
.pkg .flow small { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.pkg .desc { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.pkg .price { font-size: 20px; font-weight: 700; color: #F53F3F; margin-top: auto; }
.pkg .price small { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.pkg .ops { margin-top: 12px; display: flex; gap: 8px; }
.pkg .ops .btn { flex: 1; justify-content: center; }

/* ---------- 支付页 ---------- */
.pay-box { max-width: 420px; margin: 0 auto; text-align: center; }
.pay-amount { font-size: 30px; font-weight: 700; color: #F53F3F; }
.pay-qr {
    width: 220px; height: 220px; margin: 18px auto; padding: 10px;
    border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.pay-qr img { width: 100%; height: 100%; display: block; }
.pay-tip { font-size: 13px; color: var(--text-muted); line-height: 1.9; }
.pay-state { font-size: 14px; margin-top: 12px; }
.pay-done { text-align: center; padding: 20px 0; }
.pay-done .ico {
    width: 58px; height: 58px; border-radius: 50%; background: #00B42A; color: #fff;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}

/* ---------- 登录：左右分栏 + 品牌轮播（门户版） ---------- */
.pl-split {
    display: flex; width: 100%; max-width: 940px; margin: 22px auto 16px;
    min-height: 500px; background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 14px 40px rgba(29,33,41,.09); border: 1px solid var(--border-light, #F2F3F5);
}
.pl-side {
    flex: 1.15; padding: 38px 36px; display: flex; flex-direction: column; position: relative;
    background: linear-gradient(158deg, #E4FBF8 0%, #F1FBFB 52%, #E9F4FF 100%);
}
.pl-side .lb { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.pl-side .lb .lg {
    width: 34px; height: 34px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 15px;
    background: linear-gradient(135deg, #2BD9D4, #0E9FA8);
    display: flex; align-items: center; justify-content: center;
}
.pl-side .lb .nm { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.25; }
.pl-side .lb .en { font-size: 11px; color: #6B7A8F; letter-spacing: .4px; }
.pl-side .slide h2 { color: #0B8F8C; }
.pl-side .dots i { background: #A9E3E0; }
.pl-side .dots i.on { background: #0FC6C2; }

.pl-form {
    flex: 1; max-width: 400px; padding: 40px 38px;
    display: flex; flex-direction: column; justify-content: center;
}
.pl-form h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.pl-form .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.pl-form .field { margin-bottom: 15px; }
.pl-form label { display: block; font-size: 13px; color: #4E5969; margin-bottom: 6px; }
.pl-form .ipt { position: relative; }
.pl-form .ipt > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #86909C; }
.pl-form .ipt input { height: var(--ipt-h-lg); padding-left: 40px; border-radius: var(--radius-ctl); }
.pl-form .ipt input:focus { border-color: #1E9FFF; box-shadow: 0 0 0 3px rgba(30, 159, 255, .16); }
.pl-form .ipt .eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: #86909C; cursor: pointer; display: flex; padding: 4px;
}
.pl-form .ipt .eye:hover { color: #0FC6C2; }
.pl-form .btn { width: 100%; justify-content: center; height: 40px; font-size: 14px; margin-top: 6px; }
.pl-form .foot {
    margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-light, #F2F3F5);
    font-size: 12px; color: var(--text-muted); text-align: center;
}

/* 兼容旧的单卡登录 */
.p-login { max-width: 400px; margin: 30px auto; }

/* 快捷金额 */
.amts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.amt {
    padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-ctl);
    background: #fff; cursor: pointer; font-size: 13.5px; font-family: inherit; color: var(--text);
    transition: .15s; min-height: 36px;
}
.amt:hover { border-color: #1E9FFF; color: #0E6FD1; }
.amt.on { border-color: #1E9FFF; background: #E8F3FF; color: #0E6FD1; font-weight: 500; }

/* ---------- 首页操作按钮组 ---------- */
.p-ops .bd { display: flex; gap: 10px; flex-wrap: wrap; }
.p-ops .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }

/* ---------- 手机端底部导航（≤760px 显示，桌面端隐藏） ---------- */
.p-tabbar { display: none; }

/* 响应式：桌面端不变，手机端重排 */
@media (max-width: 860px) {
    .pl-split { min-height: 0; flex-direction: column; }
    .pl-side { display: none; }
    .pl-form { max-width: none; padding: 28px 22px; }
}

@media (max-width: 760px) {
    /* ---- 顶部：只留品牌 + 退出，导航移到底部 Tab ---- */
    .p-top .p-wrap { height: 54px; flex-wrap: nowrap; gap: 10px; padding: 0 14px; }
    .p-nav { display: none; }
    .p-brand { flex: 1; min-width: 0; }
    .p-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .p-slogan { font-size: 10.5px; }
    .p-user { gap: 8px; flex-shrink: 0; }
    .p-iccid { display: none; }
    /* 40px 触控高度：比底部 Tab 略小，但满足拇指点击 */
    .p-out {
        padding: 0 12px; min-height: 40px; border-radius: 9px;
        background: #F7F8FA; font-size: 12.5px;
        display: inline-flex; align-items: center; gap: 5px;
    }
    .p-out:hover { background: #F2F3F5; }
    .p-out:active { background: #E5E6EB; }

    /* ---- 主体留出底部导航空间（含 iPhone 安全区），footer 不被遮挡 ---- */
    body.portal { padding-bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
    .p-body { padding: 14px 0 20px; }
    .p-wrap { padding: 0 14px; }
    .p-ops .btn { flex: 1 1 calc(50% - 5px); }
    .p-ops .btn-orders { display: none; }   /* 与底部 Tab 重复 */

    /* ---- 底部 Tab 导航 ---- */
    .p-tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        background: rgba(255,255,255,.97); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    }
    .p-tabbar a {
        flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 5px 2px; border-radius: 10px; color: #86909C; font-size: 11px;
        text-decoration: none; min-height: 48px; justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }
    .p-tabbar a:active { background: #F2F3F5; }
    .p-tabbar a.active { color: #0E6FD1; font-weight: 500; }
    .p-tabbar a.active svg { color: #1E9FFF; }
    .p-tabbar a.tab-out { flex: 0 0 64px; }

    /* ---- 流量主视觉 ---- */
    .flow-hero { padding: 20px 18px; border-radius: 12px; }
    .flow-hero .big { font-size: 30px; }
    .flow-hero .bar { height: 9px; margin-top: 14px; }

    /* ---- 信息网格：两列 ---- */
    .p-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
    .p-item { padding: 10px 12px; }
    .p-item .v { font-size: 14px; }

    /* ---- 卡片与触控 ---- */
    .p-card .hd { padding: 13px 14px; }
    .p-card .bd { padding: 14px; }
    .p-card .bd.flush { padding: 0; }
    .btn { min-height: 44px; }                 /* iOS 最低触控标准 */
    .btn-sm { min-height: 36px; }
    .p-card .hd .btn-sm { min-height: 34px; }

    /* ---- 套餐：单列 ---- */
    .pkgs { grid-template-columns: 1fr; gap: 12px; }
    .pkg { padding: 16px; }
    .pkg .ops .btn { width: 100%; }

    /* ---- 充值表单 ---- */
    .form-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .form-row > label { width: auto; text-align: left; }
    .form-row .ctl { min-width: 0; width: 100%; }
    .amts .amt { flex: 1 1 calc(33% - 6px); text-align: center; padding: 11px 8px; }

    /* ---- 订单/支付记录表格 → 卡片化 ---- */
    .table-wrap { overflow: visible; }
    .table-wrap table.tbl, .table-wrap table.tbl tbody, .table-wrap table.tbl tr,
    .table-wrap table.tbl td { display: block; width: 100%; }
    .table-wrap table.tbl thead { display: none; }
    .table-wrap table.tbl tr {
        padding: 12px 14px; border-bottom: 1px solid var(--border-light);
    }
    .table-wrap table.tbl tr:last-child { border-bottom: 0; }
    .table-wrap table.tbl td {
        padding: 3px 0; border: 0; display: flex; justify-content: space-between;
        align-items: center; gap: 12px; white-space: normal;
    }
    .table-wrap table.tbl td::before {
        content: attr(data-label); flex-shrink: 0;
        font-size: 12px; color: var(--text-muted);
    }
    .table-wrap table.tbl td.mono {
        font-size: 12.5px; word-break: break-all; text-align: right;
    }
    .table-wrap table.tbl td.nowrap { white-space: normal; text-align: right; }
    /* 表格内链接（如「详情」）在手机上放大为可点击块，避免 22px 误触 */
    .table-wrap table.tbl td a {
        display: inline-flex; align-items: center; justify-content: center;
        min-height: 36px; padding: 0 14px; margin: 2px 0;
        border-radius: 8px; background: #F2F3F5; text-decoration: none;
    }
    .table-wrap table.tbl td a:active { background: #E5E6EB; }

    /* ---- 分页 ---- */
    .pager { padding: 10px 14px; justify-content: center; }
    .pager-item { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }

    /* ---- 支付页 ---- */
    .pay-qr { width: min(64vw, 240px); height: min(64vw, 240px); }
    .pay-amount { font-size: 28px; }

    /* 空状态里的行内链接（如「去购买套餐」）放大为可点块 */
    .empty a {
        display: inline-flex; align-items: center; justify-content: center;
        min-height: 36px; padding: 0 12px; margin: 0 2px;
        border-radius: 8px; background: #F2F3F5; text-decoration: none;
    }

    /* ---- 底部 ---- */
    .p-foot { padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 12px; }
    .p-foot-tel { display: block; margin: 4px 0 0 !important; }
    .p-foot-admin {
        display: inline-flex; align-items: center; justify-content: center;
        min-height: 40px; padding: 0 16px; margin: 6px auto 0 !important;
        border-radius: 8px; background: #F7F8FA; text-decoration: none;
    }
}

/* 小屏再收紧（≤360px） */
@media (max-width: 360px) {
    .p-name { font-size: 13px; }
    .p-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .flow-hero .big { font-size: 26px; }
    .pl-form { padding: 24px 16px; }
}
