/* ============================================================================
 * 轻量应用开放平台 — 用户中心样式（C 端）
 *
 * 设计语言与 landing.php / admin.css / bank/public.css 完全对齐：
 *   故宫墨红 #8C3232 · 玄石 #363636 · 宣纸 #CAD2C5 · 圆角 14px
 *
 * ⚠️ 改本文件后必须同步 bump 页面里的 ?v=（见各 user/*.php 的 <link>），
 *    否则浏览器会继续吃旧缓存，出现「改了像没改」的错觉。
 * ========================================================================== */

:root {
    --brand: #8C3232;
    --brand-600: #6E2727;
    --brand-700: #57201F;
    --brand-50: #F5EAE9;
    --brand-100: #EBD6D4;
    --ink: #363636;
    --muted: #6B6B6B;
    --line: #DDE3D9;
    --bg: #F2F5F1;
    --paper: #CAD2C5;
    --radius: 14px;
    --shadow: 0 12px 32px rgba(54, 54, 54, .10);
    --danger: #A33A34;
    --success: #4F7A5B;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ---------- 滚动条（全站统一标准：6px / #C3C3C3 / 圆角 999px / hover #A3A3A3）
   注：scrollbar-width / scrollbar-color 是标准属性（Firefox 全支持，Chrome 121+ 亦支持），
       配四条 ::-webkit-* 覆盖 Chromium/Safari；主滚动条挂 html 而非 body。
   ---------------------------------------------------------------------------- */
:is(html, .scroll-y, .auth-card) {
    scrollbar-width: thin;
    scrollbar-color: #C3C3C3 transparent;
}
:is(html, .scroll-y, .auth-card)::-webkit-scrollbar { width: 6px; height: 6px; }
:is(html, .scroll-y, .auth-card)::-webkit-scrollbar-track { background: transparent; }
:is(html, .scroll-y, .auth-card)::-webkit-scrollbar-thumb { background: #C3C3C3; border-radius: 999px; }
:is(html, .scroll-y, .auth-card)::-webkit-scrollbar-thumb:hover { background: #A3A3A3; }

/* ---------- 顶栏 ---------- */
.nav {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.nav-in { max-width: 1120px; margin: 0 auto; padding: 0 22px; height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 38px; height: 38px; object-fit: contain; display: block; }
.brand .nm { font-weight: 700; font-size: 16px; letter-spacing: .2px; line-height: 1.25; }
.brand .sub { font-size: 12px; color: var(--muted); }
.nav-right { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.nav-right a { color: #4A4A4A; transition: color .15s; }
.nav-right a:hover { color: var(--brand); }
.nav-user { display: flex; align-items: center; gap: 9px; }
.nav-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
/* 徽章现在是 <a>，需覆盖 .nav-right a 的颜色/hover，保证白字不掉色、无下划线 */
.nav-user .nav-avatar { color: #fff; text-decoration: none; }
.nav-user .nav-avatar:hover { color: #fff; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 22px;
    border-radius: 10px; font-size: 15px; font-weight: 600;
    cursor: pointer; border: 1px solid transparent;
    transition: all .16s; white-space: nowrap;
    font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-primary:active { transform: scale(.985); }
.btn-primary[disabled], .btn-primary.is-disabled { background: #C9AEAD; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: #4A4A4A; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }

/* ---------- 认证页（登录 / 注册 / 扫码） ---------- */
.auth-wrap {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 44px 20px 60px;
    position: relative;
    overflow: hidden;
}
.auth-wrap::before {
    content: ""; position: absolute; z-index: 0;
    top: -240px; right: -180px; width: 620px; height: 620px; border-radius: 50%;
    background: radial-gradient(circle, rgba(140, 50, 50, .10), transparent 68%);
    pointer-events: none;
}
.auth-wrap::after {
    content: ""; position: absolute; z-index: 0;
    bottom: -260px; left: -200px; width: 560px; height: 560px; border-radius: 50%;
    background: radial-gradient(circle, rgba(202, 210, 197, .45), transparent 70%);
    pointer-events: none;
}
.auth-card {
    position: relative; z-index: 1;
    width: 100%; max-width: 412px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 34px 34px 30px;
    box-shadow: var(--shadow);
    animation: rise .5s both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head .logo {
    width: 54px; height: 54px; border-radius: 15px;
    background: var(--brand-50); border: 1px solid var(--brand-100);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.auth-head .logo img { width: 34px; height: 34px; object-fit: contain; display: block; }
.auth-head h1 { margin: 0 0 6px; font-size: 23px; font-weight: 800; letter-spacing: -.3px; }
.auth-head p { margin: 0; font-size: 13.5px; color: var(--muted); }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #4A4A4A; margin-bottom: 7px; }
.form-input {
    width: 100%; height: 46px;
    padding: 0 14px;
    background: #FBFCFA;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14.5px; color: var(--ink);
    font-family: inherit;
    outline: none;
    transition: border-color .16s, background .16s, box-shadow .16s;
}
.form-input::placeholder { color: #A9A9A9; }
.form-input:focus {
    background: #fff;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(140, 50, 50, .12);
}
.form-input[readonly] { background: #F4F6F3; color: var(--muted); cursor: not-allowed; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-actions { margin-top: 22px; }

/* ---------- 邮箱验证码行（输入框 + 发送按钮） ---------- */
.code-row { display: flex; gap: 10px; align-items: stretch; }
.code-row .form-input { flex: 1; min-width: 0; }
.btn-code {
    flex-shrink: 0;
    height: 46px;                 /* 与 .form-input 完全等高 */
    padding: 0 16px;
    font-size: 14px;
    border-radius: 10px;
}
/* 倒计时期间是禁用态：要盖掉 .btn-ghost:hover 的变色，否则看起来仍可点 */
.btn-code[disabled] {
    color: #A9A9A9; border-color: var(--line);
    background: #F7F8F6; cursor: not-allowed;
}

/* ---------- 登录方式切换（密码 / 邮箱验证码） ---------- */
.tabs {
    display: flex; gap: 6px;
    background: #F4F6F3; border: 1px solid var(--line);
    border-radius: 11px; padding: 4px;
    margin-bottom: 20px;
}
.tab {
    flex: 1; height: 36px;
    border: none; background: transparent;
    border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted);
    cursor: pointer; transition: all .16s; font-family: inherit;
}
.tab:hover { color: var(--brand); }
.tab.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(54, 54, 54, .08); }
.tab-pane { display: none; }
.tab-pane.on { display: block; animation: fade .22s both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* 密码框下的「忘记密码？」 */
.auth-minor { margin: 12px 0 0; text-align: right; font-size: 13px; }
.auth-minor a { color: var(--brand); font-weight: 600; }
.auth-minor a:hover { text-decoration: underline; }

/* ---------- 提示条 ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 11px 14px; border-radius: 10px;
    font-size: 13.5px; margin-bottom: 18px;
    border: 1px solid transparent;
    line-height: 1.5;
}
.alert-danger { background: #FBF0EF; border-color: #EBCFCD; color: var(--danger); }
.alert-success { background: #F0F5F1; border-color: #D3E2D8; color: var(--success); }
.alert-info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-600); }
.alert svg { flex-shrink: 0; margin-top: 2px; }

/* ---------- 分隔线 / 次要入口 ---------- */
.auth-foot { margin-top: 20px; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-foot a { color: var(--brand); font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 16px; color: #A9A9A9; font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.sso-btn {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; height: 46px;
    background: #FBFCFA; border: 1px dashed var(--line);
    border-radius: 10px; font-size: 14px; font-weight: 600; color: #4A4A4A;
    cursor: pointer; transition: all .16s; font-family: inherit;
}
.sso-btn:hover { border-color: var(--brand-100); color: var(--brand); background: #FDFBFB; }
.sso-btn.is-disabled { cursor: not-allowed; color: #A9A9A9; background: #F7F8F6; border-style: dashed; }
.sso-btn.is-disabled:hover { border-color: var(--line); color: #A9A9A9; background: #F7F8F6; }
.tag-soon {
    font-size: 11px; font-weight: 600; color: var(--brand-600);
    background: var(--brand-50); border: 1px solid var(--brand-100);
    border-radius: 999px; padding: 1px 8px;
}

/* ---------- 用户中心 ---------- */
.page { flex: 1; width: 100%; }
.container { max-width: 1120px; margin: 0 auto; padding: 34px 22px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.ph-left { min-width: 0; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }
/* 移动端「退出」：文字链，样式对齐桌面端头部 .nav-logout；桌面端隐藏（头部已有退出） */
.ph-logout { display: none; margin-top: 7px; font-size: 14px; color: #4A4A4A; text-decoration: none; transition: color .15s; white-space: nowrap; }
.ph-logout:hover { color: var(--brand); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }
.panel {
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); padding: 24px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-title { display: flex; align-items: center; gap: 9px; font-size: 15.5px; font-weight: 700; }
.panel-title svg { color: var(--brand); }
.panel-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.kv { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { font-size: 13px; color: var(--muted); }
.kv-row .v { font-size: 14px; font-weight: 600; }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600;
    border-radius: 999px; padding: 3px 10px;
    border: 1px solid transparent;
}
.badge-success { background: #F0F5F1; border-color: #D3E2D8; color: var(--success); }
.badge-muted { background: #F4F5F3; border-color: #E2E5E0; color: #8F8F8F; }
.badge-brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-600); }

.app-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.app-item {
    display: flex; align-items: center; gap: 13px;
    border: 1px solid var(--line); border-radius: 12px; padding: 15px;
    transition: all .16s;
}
.app-item:hover { border-color: var(--brand-100); background: #FCFAF9; transform: translateY(-1px); }
.app-ic {
    width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand);
}
.app-name { font-weight: 600; font-size: 14px; }
.app-sub { font-size: 12px; color: var(--muted); }
.app-item .go { margin-left: auto; color: #C4C4C4; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); font-size: 13.5px; }

/* ---------- 扫码登录页 ---------- */
.qr-box {
    width: 208px; height: 208px; margin: 0 auto 18px;
    border: 1px solid var(--line); border-radius: 14px;
    background: #fff; padding: 12px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.qr-box img, .qr-box canvas { width: 100%; height: 100%; display: block; }
.qr-box .qr-placeholder {
    width: 100%; height: 100%;
    border: 1px dashed var(--line); border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 9px; color: #A9A9A9; font-size: 12.5px; text-align: center; padding: 10px;
}
.qr-status { text-align: center; font-size: 13.5px; color: var(--muted); min-height: 22px; }
.qr-status.ok { color: var(--success); font-weight: 600; }
.qr-tip { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* ---------- 轻提示（toast） ---------- */
/* 由 userScripts() 里的 puToast() 动态创建，页面不用预留容器 */
#pu-toast {
    position: fixed; z-index: 999;
    top: 78px; right: 22px;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}
.toast {
    min-width: 180px; max-width: 320px;
    padding: 11px 15px;
    border-radius: 10px;
    font-size: 13.5px; font-weight: 600;
    background: #fff; color: var(--ink);
    border: 1px solid var(--line);
    box-shadow: 0 10px 26px rgba(54, 54, 54, .14);
    animation: toastIn .22s both;
    transition: opacity .4s, transform .4s;
}
.toast-ok { background: #F3F8F4; border-color: #D3E2D8; color: var(--success); }
.toast-err { background: #FCF3F2; border-color: #EBCFCD; color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 页脚 ---------- */
.foot { border-top: 1px solid var(--line); background: #fff; margin-top: auto; flex-shrink: 0; }
.foot-in { max-width: 1120px; margin: 0 auto; padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.foot-in a:hover { color: var(--brand); }
/* 页脚子结构：对齐 landing.php —— LOGO + 版权(+标语) 居左，底部链接居右（桌面） */
.foot-in .fl { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.foot-in .fl img { width: 28px; height: 28px; }
.foot-links { display: flex; gap: 22px; font-size: 13px; color: #4A4A4A; }
.foot-links a:hover { color: var(--brand); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
    .grid-2 { grid-template-columns: 1fr; }
    .app-list { grid-template-columns: 1fr; }
    /* 移动端：隐藏右侧「应用中心」首页链接（对应 bank 隐藏「返回首页」；品牌名已是回首页入口） */
    .nav-home { display: none; }
    /* 移动端：登录态只留用户徽章，用户名与退出隐藏（徽章本身可点击回用户中心） */
    .nav-uname { display: none; }
    .nav-logout { display: none; }
    /* 页脚移动端：对齐 landing —— 仅留 LOGO + 版权一行并居中，隐藏标语与底部链接 */
    .fl-tag { display: none; }
    .fl-sep { display: none; }
    .foot-links { display: none; }
    .foot-in { justify-content: center; }
    /* 移动端：页面标题「你好，xxx」右侧显示文字「退出」（补齐被隐藏的头部退出入口） */
    .ph-logout { display: inline-flex; }
}
@media (max-width: 520px) {
    .auth-card { padding: 28px 22px 24px; border-radius: 16px; }
    .auth-head h1 { font-size: 21px; }
    .container { padding: 26px 16px 48px; }
    .nav-in { padding: 0 16px; }
    /* 邮箱验证码行保持一行，只收窄按钮，避免把输入框挤没 */
    .code-row { gap: 8px; }
    .btn-code { padding: 0 12px; font-size: 13px; }
    /* toast 在窄屏铺满宽度，否则右侧贴边容易超宽 */
    #pu-toast { left: 14px; right: 14px; top: 74px; }
    .toast { max-width: none; }
}
