/* ============================================================================
   liveling 通行证 · 前台样式表（单文件）
   ----------------------------------------------------------------------------
   视觉方向：圆形 App 风（Telegram / iOS 关键词）
   浅灰画布 #F2F2F7 + 纯白大圆角卡片 + 主蓝 #3390EC 胶囊按钮，
   层级只靠底色差，页面卡片不用阴影（只有弹层用）。
   全站只有这一套令牌，登录页与后台页共用。
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
    /* 颜色 */
    --bg: #F2F2F7;            /* 页面画布、输入框底、分段容器底 */
    --bg-2: #EAEAF0;          /* 画布上的次级底（按压、悬浮） */
    --card: #FFFFFF;          /* 卡片 */
    --primary: #3390EC;       /* 主蓝：主按钮、链接、选中文字 */
    --primary-deep: #1C6FBF;  /* 主蓝按压 / 悬停 */
    --primary-weak: #E8F2FD;  /* 浅蓝：选中底、次按钮、图标底 */
    --text: #0F1720;          /* 主文字 */
    --text-2: #3B4148;        /* 正文次级 */
    --muted: #8A9099;         /* 辅助文字、占位符 */
    --faint: #A2A7AF;         /* 脚注、版本号 */
    --line: #EDEEF2;          /* 发丝分隔线 */
    --line-2: #E3E5EA;        /* 稍重的分隔线（卡片内分组） */
    --ok: #2E9E5B;
    --ok-weak: #EAF6EF;
    --warn: #B7791F;
    --warn-weak: #FBF1E0;
    --danger: #E0524D;
    --danger-weak: #FDEEED;

    /* 圆角 */
    --r-card: 24px;           /* 页面卡片 */
    --r-input: 16px;          /* 输入框、提示条 */
    --r-sm: 12px;             /* 小元素：徽标、内嵌块 */
    --r-pill: 999px;          /* 按钮、分段选中、导航药丸 */
    --r-nav: 28px;            /* 悬浮胶囊导航 */

    /* 间距（8 档位） */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;

    /* 阴影：页面卡片不用，只有弹层用 */
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .16);
    --shadow-pop-sm: 0 6px 18px rgba(0, 0, 0, .10);

    /* 字 */
    --font-sans: system-ui, -apple-system, "SF Pro Display", "Segoe UI Variable Text",
                 "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", ui-monospace, Consolas,
                 "Liberation Mono", monospace;

    /* 尺寸 */
    --topbar-h: 60px;
    --content: 1120px;
    --ease: cubic-bezier(.22, .68, .3, 1);
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after { box-sizing: border-box; }

/* hidden 属性永远优先于组件的 display */
[hidden] { display: none !important; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color .16s var(--ease);
}
a:hover { color: var(--primary-deep); }

img { max-width: 100%; display: block; }

code, kbd, .mono, .num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}
code { font-size: .92em; }

::selection { background: var(--primary-weak); color: var(--primary-deep); }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ---------------------------------------------------------------- 文本工具 */
.sub { color: var(--muted); font-size: 13.5px; }
.hint { font-size: 12px; line-height: 1.55; color: var(--muted); }
.link-sm { font-size: 13px; font-weight: 500; color: var(--primary); }
.link-sm:hover { color: var(--primary-deep); }
.meta { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* 文字按钮（返回、重新扫码） */
.link-btn {
    appearance: none;
    padding: 6px 13px;
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .16s var(--ease);
}
.link-btn:hover { background: var(--primary-weak); }

.rule { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--bg-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(51, 144, 236, .28); }

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-deep); color: #fff; }

.btn--soft { background: var(--primary-weak); color: var(--primary); }
.btn--soft:hover { background: #DCEBFB; color: var(--primary-deep); }

.btn--quiet { background: transparent; color: var(--muted); }
.btn--quiet:hover { background: var(--bg); color: var(--text); }


.btn--sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn--block { width: 100%; }

.btn[disabled],
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------- 表单 */
.field { display: grid; gap: 7px; min-width: 0; }

.label { font-size: 12.5px; font-weight: 500; color: var(--muted); }

.input {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    border: 1.5px solid transparent;
    border-radius: var(--r-input);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color .16s var(--ease), background .16s var(--ease);
}
.input::placeholder { color: var(--muted); }
.input:hover { background: #ECECF3; }
.input:focus {
    outline: none;
    background: var(--card);
    border-color: var(--primary);
}
.input:disabled { color: var(--muted); cursor: not-allowed; }

select.input {
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%238A9099' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }

.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.input-group .btn { flex: none; height: 48px; padding: 0 15px; font-size: 13.5px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.form-grid .field--full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: var(--sp-3); align-items: center; margin-top: var(--sp-5); flex-wrap: wrap; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }

/* ---------------------------------------------------------------- 分段控件 */
.seg {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: var(--r-pill);
    background: var(--bg);
}
.seg button {
    flex: 1;
    height: 38px;
    border: 0;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.is-active { background: var(--primary-weak); color: var(--primary); }

/* ---------------------------------------------------------------- 徽标 / 标签 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--r-pill);
    background: var(--bg);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}
.badge--ok { background: var(--ok-weak); color: var(--ok); }
.badge--off { background: var(--bg); color: var(--muted); }
.badge--danger { background: var(--danger-weak); color: var(--danger); }

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--r-sm);
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.tag--accent { background: var(--primary-weak); color: var(--primary); }

/* ---------------------------------------------------------------- 头像 */
.avatar {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-weak);
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    flex: none;
}
.avatar--lg { width: 56px; height: 56px; font-size: 20px; }
.avatar--xl { width: 96px; height: 96px; font-size: 34px; }

.avatar-wrap {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
}
.avatar-wrap > * { grid-area: 1 / 1; }
.avatar-wrap--sm { width: 26px; height: 26px; }
.avatar-wrap--xl { width: 96px; height: 96px; }
.avatar-wrap .avatar { width: 100%; height: 100%; }

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--card);
    object-fit: cover;
}

.avatar-row { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.avatar-row__actions { display: flex; flex-direction: column; gap: 6px; }
.avatar-row > .btn { margin-left: auto; }

/* 上传控件：把原生 file input 藏在按钮下面 */
.file-btn { position: relative; display: inline-flex; }
.file-btn input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    height: var(--topbar-h);
    padding: 0 var(--sp-6);
    background: rgba(242, 242, 247, .86);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: -.01em;
}
.brand:hover { color: var(--text); }
.brand__logo { width: 30px; height: 30px; border-radius: 10px; object-fit: cover; }
.brand__sub { font-size: 12px; font-weight: 500; color: var(--muted); }

.nav { display: flex; align-items: center; gap: 2px; margin-left: var(--sp-2); }
.nav a {
    height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--r-pill);
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.nav a:hover { background: var(--bg-2); color: var(--text); }
.nav a.is-active { background: var(--primary-weak); color: var(--primary); }

.spacer { margin-left: auto; }

/* 用户下拉：纯 CSS details，无脚本也能用 */
.menu { position: relative; }
.menu > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px 0 6px;
    border-radius: var(--r-pill);
    background: var(--card);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s var(--ease);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::marker { content: ""; }
.menu > summary:hover { background: var(--bg-2); }

.menu__chevron {
    width: 8px;
    height: 8px;
    border-right: 1.6px solid var(--muted);
    border-bottom: 1.6px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .18s var(--ease);
}
.menu[open] .menu__chevron { transform: rotate(225deg) translateY(-2px); }

.menu__name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 236px;
    padding: 8px;
    border-radius: var(--r-input);
    background: var(--card);
    box-shadow: var(--shadow-pop);
    z-index: 50;
    animation: pop .16s var(--ease);
}
.menu__who { padding: 8px 10px 12px; }
.menu__who b { display: block; font-size: 13.5px; font-weight: 700; color: var(--text); }
.menu__who span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.menu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--r-sm);
    background: none;
    color: var(--text-2);
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
    transition: background .14s var(--ease), color .14s var(--ease);
}
.menu__item:hover { background: var(--bg); color: var(--text); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-weak); color: var(--danger); }

/* ---------------------------------------------------------------- 悬浮胶囊导航（手机） */
.tabbar { display: none; }

/* ---------------------------------------------------------------- 页面骨架 */
.page {
    max-width: var(--content);
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-6) 96px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-4);
    margin-bottom: var(--sp-6);
    flex-wrap: wrap;
}
.page-head h1 { font-size: 27px; }
.page-head .sub { margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }

/* ---------------------------------------------------------------- 指标 */
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
    padding: 16px 18px 18px;
    border-radius: var(--r-card);
    background: var(--card);
}
.stat__label { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.stat__value { display: flex; align-items: baseline; gap: 6px; }
.stat__value b {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat__value span { font-size: 12px; color: var(--muted); }
.stat__value--text { display: block; }
.stat__value--text b { font-size: 18px; letter-spacing: -.01em; }
.stat--accent b { color: var(--primary); }

/* 身份抬头：头像 + 名字 + 右侧元信息 */
.identity { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.identity__name { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.identity__handle { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.identity__meta { margin-left: auto; text-align: right; }
.identity__label { font-size: 12px; color: var(--muted); }
.identity__meta .num { display: block; margin-top: 4px; font-size: 12.5px; color: var(--text-2); }

/* ---------------------------------------------------------------- 卡片 */
.cards {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--sp-4);
    align-items: start;
}
.cards > .panel { margin-bottom: 0; }
.cards > form { margin: 0; min-width: 0; }

.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.stack > .panel { margin-bottom: 0; }

.panel {
    border-radius: var(--r-card);
    background: var(--card);
    margin-bottom: var(--sp-4);
    overflow: hidden;
}

.panel__head {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: 18px 20px 0;
}
.panel__head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.panel__head p { margin-top: 4px; font-size: 12.5px; color: var(--muted); max-width: 68ch; }
.panel__body { padding: 18px 20px 20px; }
.panel__foot {
    padding: 12px 20px 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
}

/* ---------------------------------------------------------------- 列表 / 表格 */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    padding: 12px 20px 10px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--muted);
    white-space: nowrap;
}
.table td {
    padding: 12px 20px;
    color: var(--text-2);
    border-top: 1px solid var(--line);
    vertical-align: middle;
}
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: #FAFAFC; }
.table .cell-num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 站点名：首字方块 + 名称 */
.site { display: flex; align-items: center; gap: 10px; min-width: 0; }
.site__mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
}
.site__mark--builtin { background: var(--primary-weak); color: var(--primary); }
.site__name { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--text); font-weight: 600; }
.site__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 键值网格：个人信息等只读字段 */
.meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.meta-grid dt { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.meta-grid dd { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

/* 活动列表 */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
    display: grid;
    grid-template-columns: 7px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}
.feed li:first-child { border-top: 0; }
.feed__dot {
    width: 7px;
    height: 7px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--ok);
}
.feed__dot--fail { background: var(--danger); }
.feed__main { min-width: 0; }
.feed__row { display: flex; align-items: baseline; gap: 10px; }
.feed__row b { font-weight: 600; color: var(--text); font-size: 13px; }
.feed__main > span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.feed__time { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------------------------------------------------------------- 空态 */
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty b { display: block; margin-bottom: 4px; font-size: 14.5px; font-weight: 600; color: var(--text); }

/* ---------------------------------------------------------------- 弹窗提示 */
.toast-stack {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 92vw;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(92vw, 460px);
    padding: 12px 18px;
    border-radius: var(--r-input);
    background: var(--card);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 550;
    line-height: 1.45;
    box-shadow: var(--shadow-pop);
    pointer-events: auto;
    cursor: pointer;
    animation: toast-in .22s var(--ease);
}
.toast__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.toast--error .toast__dot { background: var(--danger); }
.toast--info .toast__dot { background: var(--primary); }
.toast.is-out { animation: toast-out .18s ease forwards; }

/* ---------------------------------------------------------------- 登录 / 找回密码 */
.signin {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 100vh;
    padding: 40px 24px;
    background: var(--bg);
}

/* 卡片上方的品牌行 */
.signin__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}
.signin__brand:hover { color: var(--text); }
.signin__brand img {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: cover;
}
.signin__brand b { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

/* 主体卡片：左扫码 / 右表单，中间一条发丝分隔线 */
.login-card {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    width: min(880px, 100%);
    min-height: 440px;
    border-radius: var(--r-card);
    background: var(--card);
    overflow: hidden;
    animation: rise .42s var(--ease) both;
}
.login-card--solo { grid-template-columns: minmax(0, 1fr); width: min(440px, 100%); min-height: 0; }

/* ---- 左：二维码面板 ---- */
.login-card__qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 28px;
    border-right: 1px solid var(--line);
}

.qr-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
}
.qr-head svg { width: 18px; height: 18px; fill: currentColor; color: var(--primary); }

.qr-stage { display: flex; flex-direction: column; align-items: center; width: 100%; }

.qr-frame {
    position: relative;
    display: grid;
    place-items: center;
    width: 196px;
    height: 196px;
    margin: 0 auto;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
}
.qr-frame img { width: 100%; height: 100%; object-fit: contain; display: none; }
.qr-frame.is-loading::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 12px;
    background: linear-gradient(100deg, #F1F2F6 30%, #E9EAF0 50%, #F1F2F6 70%);
    background-size: 220% 100%;
    animation: shimmer 1.4s linear infinite;
}

.code {
    min-height: 16px;
    margin-top: 12px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .16em;
    color: var(--muted);
}
.code:empty { display: none; }

.qr-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 20px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}
.qr-status.is-ok { color: var(--ok); font-weight: 600; }
.qr-status.is-warn { color: var(--danger); }

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1.9s var(--ease) infinite;
    flex: none;
}

.scan-refresh {
    margin-top: 12px;
    padding: 7px 14px;
    border: 0;
    border-radius: var(--r-pill);
    background: var(--primary-weak);
    color: var(--primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.scan-refresh:hover { background: #DCEBFB; }

.scan-hint { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }

/* 已扫描：正圆头像 + 右下角绿色状态点 */
.qr-user { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; animation: pop .26s var(--ease) both; }
.qr-avatar { position: relative; display: inline-block; margin-bottom: 8px; }
.qr-avatar .avatar-wrap { width: 88px; height: 88px; }
.qr-avatar .avatar--xl { font-size: 30px; margin: 0; }
.qr-avatar__dot {
    position: absolute;
    top: 75.4%;
    left: 75.4%;
    width: 20%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--ok);
    border: 2px solid var(--card);
}
.qr-user b { font-size: 17px; font-weight: 650; letter-spacing: -.01em; color: var(--text); }
.qr-user__handle { font-size: 13px; color: var(--muted); }
.qr-user__state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ok);
}
.qr-user__state .pulse { background: var(--ok); }
.qr-user__state.is-confirmed .pulse { animation: none; }

/* ---- 右：表单面板 ---- */
.login-card__form {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 40px 44px 32px;
}

.login-tabs {
    display: flex;
    gap: 26px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.login-tabs button {
    padding: 0 0 12px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color .16s var(--ease), border-color .16s var(--ease);
}
.login-tabs button:hover { color: var(--text-2); }
.login-tabs button.is-active { color: var(--text); border-bottom-color: var(--primary); }

.login-panes { flex: 1; min-height: 224px; }

.lform { display: grid; gap: 16px; align-content: start; }

/* 表单控件：白底描边输入框 + 大号主按钮 */
.login-card .input {
    height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: var(--card);
    font-size: 15px;
}
.login-card .input:hover { background: var(--card); border-color: #D6D9E0; }
.login-card .input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, .12);
    background: var(--card);
}

.login-row { display: flex; justify-content: flex-end; }
.login-row .link-sm { font-size: 13px; }

.login-submit { width: 100%; height: 52px; margin-top: 4px; font-size: 15px; }

.code-input { position: relative; }
.code-input .input { padding-right: 118px; }
.code-send {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.code-send:hover { background: var(--primary-weak); }
.code-send[disabled] { color: var(--muted); background: none; cursor: default; }

.login-note {
    margin-top: auto;
    padding-top: 22px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
}

/* 找回密码 / 重置成功 */
.signin__back { display: inline-flex; align-items: center; align-self: flex-start; margin-bottom: 18px; }
.login-title { font-size: 24px; }
.login-lead { margin-top: 6px; margin-bottom: 24px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.reset-done { padding: 6px 0 4px; text-align: center; }
.reset-done b { display: block; margin-bottom: 4px; font-size: 17px; font-weight: 650; color: var(--text); }
.reset-done p { margin-bottom: 18px; font-size: 13px; color: var(--muted); }

.signin__version { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- 独立卡片页（扫码页 / 确认登录 / 错误页） */
.solo {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--sp-6);
}

.solo__card {
    width: 100%;
    max-width: 420px;
    padding: 28px;
    border-radius: var(--r-card);
    background: var(--card);
    animation: rise .42s var(--ease) both;
}

.solo__head { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.solo__head img { width: 32px; height: 32px; border-radius: 10px; object-fit: cover; }
.solo__head b { font-size: 14px; font-weight: 700; }
.solo__head .tag { margin-left: auto; }

.solo__title { font-size: 23px; text-align: center; }
.solo__sub { margin-top: 6px; font-size: 13px; color: var(--muted); text-align: center; }
.solo__actions { display: grid; gap: 10px; margin-top: var(--sp-5); }
.solo__actions form { margin: 0; }

.qr-actions { margin-top: var(--sp-4); }
.qr-actions .btn { display: none; }

/* 扫码步骤 */
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-2);
    margin-top: var(--sp-5);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--line);
}
.steps div { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.steps b { display: block; margin-bottom: 3px; font-size: 11.5px; font-weight: 650; color: var(--text-2); }
.steps span {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--primary-weak);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 700;
    vertical-align: 1px;
}

/* 确认登录（手机） */
.consent__client {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 14px;
    margin: 18px 0 14px;
    border-radius: var(--r-input);
    background: var(--bg);
}
.consent__client b { display: block; font-size: 14px; font-weight: 650; color: var(--text); }
.consent__client span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }

.kv {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 9px 12px;
    padding: 14px;
    border-radius: var(--r-input);
    background: var(--bg);
    font-size: 13px;
}
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; color: var(--text); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.consent__code {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
    padding: 10px;
    border-radius: var(--r-input);
    background: var(--primary-weak);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .16em;
}

.scopes { margin: 0 0 16px; padding: 14px; border-radius: var(--r-input); background: var(--bg); }
.scopes > .label { display: block; margin-bottom: 8px; }
.scopes label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 0;
    font-size: 13px;
    color: var(--text-2);
    cursor: pointer;
}
.scopes code { background: transparent; padding: 0; color: var(--text); }

.note { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-input); background: var(--bg); font-size: 12px; line-height: 1.7; color: var(--muted); }

/* 错误页 */
.error-code {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    margin-bottom: 12px;
    border-radius: var(--r-pill);
    background: var(--primary-weak);
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
}
.error-title { font-size: 22px; }
.error-message { margin-top: 8px; font-size: 14px; color: var(--text-2); }
.error-path { margin-top: 6px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.error-actions { display: flex; gap: 10px; margin-top: var(--sp-6); flex-wrap: wrap; }

/* ---------------------------------------------------------------- 页脚 */
.foot {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: var(--sp-8);
    font-size: 12px;
    color: var(--faint);
}

/* ---------------------------------------------------------------- 动效 */
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
@keyframes pop {
    from { opacity: 0; transform: translateY(-4px) scale(.985); }
    to { opacity: 1; transform: none; }
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(51, 144, 236, .32); }
    70% { box-shadow: 0 0 0 7px rgba(51, 144, 236, 0); }
    100% { box-shadow: 0 0 0 0 rgba(51, 144, 236, 0); }
}
@keyframes shimmer {
    from { background-position: 130% 0; }
    to { background-position: -30% 0; }
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateY(-6px); }
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1000px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cards { grid-template-columns: 1fr; gap: var(--sp-3); }
    .cards > .col-4,
    .cards > .col-5,
    .cards > .col-7,
    .cards > .col-8,
    .cards > .col-12 { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .signin { display: flex; padding: 28px 16px; gap: 18px; }
    .signin__aside { display: none; }
    .signin__main {
        min-height: 100vh;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 18px;
        padding: var(--sp-6) var(--sp-4);
    }
    .login-card { width: 100%; max-width: 440px; min-height: 0; }
    .login-card__qr { display: none; }
    .login-card__form { padding: 28px 22px 24px; }
    .login-panes { min-height: 232px; }
    .login-note { margin-top: 12px; padding-top: 0; }
}

@media (max-height: 720px) {
    .login-card { height: auto; min-height: 560px; }
}

@media (max-width: 860px) {
    .page { padding: 24px 16px 56px; }
    .page-head h1 { font-size: 23px; }
    .page-head .actions { width: 100%; margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    /* 手机上只留品牌 + 用户菜单，主导航改用底部悬浮胶囊 */
    .topbar { padding: 0 16px; gap: 10px; }
    .nav, .topbar > .btn { display: none; }
    .brand > span { display: none; }
    .brand__logo { width: 28px; height: 28px; }
    .menu > summary .menu__name { display: none; }
    .menu > summary { padding: 0 8px 0 5px; }

    .stats, .stats--3 { grid-template-columns: 1fr 1fr; }
    .stat { padding: 14px 16px 16px; }
    .stat__value b { font-size: 24px; }
    .panel__head { padding: 16px 16px 0; flex-wrap: wrap; }
    .panel__head .meta { margin-left: 0; }
    .panel__body { padding: 16px; }
    .panel__foot { padding: 12px 16px; }
    .table th, .table td { padding-left: 16px; padding-right: 16px; }
    .feed li { padding-left: 16px; padding-right: 16px; }
    .solo { padding: 16px; align-items: start; }
    .solo__card { padding: 24px 20px; margin-top: 12px; }

    /* 悬浮胶囊导航：跟内容一起滚，滚到底再贴到屏幕底部 */
    .tabbar {
        position: sticky;
        bottom: max(16px, env(safe-area-inset-bottom));
        z-index: 60;
        display: flex;
        width: max-content;
        margin: 20px auto 0;
        gap: 4px;
        padding: 6px;
        border-radius: var(--r-nav);
        background: var(--card);
        box-shadow: var(--shadow-pop-sm);
    }
    .tabbar a {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        height: 44px;
        padding: 0 16px;
        border-radius: var(--r-pill);
        color: var(--muted);
        font-size: 13.5px;
        font-weight: 600;
        white-space: nowrap;
    }
    .tabbar a.is-active { background: var(--primary-weak); color: var(--primary); }
    .tabbar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
