/* =========================================================================
   光遇代跑平台 - 主样式表 app.css
   设计风格：光·遇 烛光与晨昏天空美学 —— 暖琥珀主色 + 柔和天空蓝点缀
   结构：CSS 变量主题 → 应用壳 → 页头/内容/底部导航 → 组件 → 工具类
   ========================================================================= */

/* =========================================================================
   1. 设计令牌（CSS 变量）—— 浅色主题（默认）
   ========================================================================= */
:root {
    /* 背景与表面 */
    --bg: #f6f5f1;            /* 暖奶油底色，模拟晨光天空 */
    --bg-elevated: #ffffff;   /* 卡片/弹层表面 */
    --bg-soft: #f0eeea;       /* 次级表面（输入框底、分割带） */
    --bg-inset: #eae8e2;      /* 凹陷区域 */

    /* 文本 */
    --text: #2b2b36;          /* 主文本 */
    --text-muted: #7c7c89;    /* 次要文本 */
    --text-faint: #a8a8b3;    /* 占位/禁用 */

    /* 边框与分割 */
    --border: #ece9e2;
    --border-strong: #ddd9d0;

    /* 主题色（烛光琥珀） */
    --primary: #e89a2f;       /* 主色 */
    --primary-hover: #d4861b; /* 悬停 */
    --primary-soft: #fdf0d9;  /* 主色淡底（徽章/选中态） */
    --on-primary: #ffffff;    /* 主色上的文字 */

    /* 点缀色（天空蓝） */
    --accent: #4a93d9;
    --accent-soft: #e2eef9;

    /* 语义色 */
    --danger: #db444a;
    --danger-soft: #fbe9ea;
    --success: #2e9c66;
    --success-soft: #e4f4eb;
    --warning: #e08a00;
    --warning-soft: #fbeed8;
    --info: #4a93d9;
    --info-soft: #e2eef9;

    /* 阴影 */
    --shadow: 0 2px 10px rgba(60, 45, 10, 0.06);
    --shadow-lg: 0 12px 32px rgba(60, 45, 10, 0.12);
    --shadow-tab: 0 -2px 14px rgba(60, 45, 10, 0.05);
    --ring: 0 0 0 3px rgba(232, 154, 47, 0.22);

    /* 圆角 */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --radius-full: 999px;

    /* 间距与尺寸 */
    --space: 16px;
    --header-h: 56px;
    --tabbar-h: 60px;
    --shell-max: 520px;

    /* 字体 */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif;

    /* 动效 */
    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 深色主题：显式 data-theme="dark" */
[data-theme="dark"] {
    --bg: #141520;            /* 深夜空 */
    --bg-elevated: #1e1f2c;   /* 抬升表面 */
    --bg-soft: #191a26;
    --bg-inset: #131420;

    --text: #e9e9f2;
    --text-muted: #8e8ea0;
    --text-faint: #5e5e70;

    --border: #2c2d3e;
    --border-strong: #3a3b50;

    --primary: #ffb347;       /* 暗色下更亮的烛光 */
    --primary-hover: #ffc266;
    --primary-soft: #2e2310;
    --on-primary: #1a1206;

    --accent: #6bb1f0;
    --accent-soft: #16233a;

    --danger: #ff6b6e;
    --danger-soft: #3a1819;
    --success: #4ec38a;
    --success-soft: #142a1e;
    --warning: #ffb347;
    --warning-soft: #3a2810;
    --info: #6bb1f0;
    --info-soft: #16233a;

    --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
    --shadow-tab: 0 -2px 14px rgba(0, 0, 0, 0.4);
    --ring: 0 0 0 3px rgba(255, 179, 71, 0.28);
}

/* 未显式指定主题时跟随系统（仅在未设 data-theme 或 data-theme=auto 时生效） */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #141520;
        --bg-elevated: #1e1f2c;
        --bg-soft: #191a26;
        --bg-inset: #131420;
        --text: #e9e9f2;
        --text-muted: #8e8ea0;
        --text-faint: #5e5e70;
        --border: #2c2d3e;
        --border-strong: #3a3b50;
        --primary: #ffb347;
        --primary-hover: #ffc266;
        --primary-soft: #2e2310;
        --on-primary: #1a1206;
        --accent: #6bb1f0;
        --accent-soft: #16233a;
        --danger: #ff6b6e;
        --danger-soft: #3a1819;
        --success: #4ec38a;
        --success-soft: #142a1e;
        --warning: #ffb347;
        --warning-soft: #3a2810;
        --info: #6bb1f0;
        --info-soft: #16233a;
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.55);
        --shadow-tab: 0 -2px 14px rgba(0, 0, 0, 0.4);
        --ring: 0 0 0 3px rgba(255, 179, 71, 0.28);
    }
}

/* =========================================================================
   2. 基础重置与全局
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 主题切换平滑过渡 */
    transition: background-color var(--transition), color var(--transition);
    /* 桌面端外区背景渐淡，烘托居中应用壳 */
    background-image: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.3; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }

/* 可访问性：聚焦轮廓 */
:focus-visible {
    outline: none;
    box-shadow: var(--ring);
    border-radius: var(--radius-sm);
}

/* 链接聚焦可见 */
a:focus-visible, button:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

/* 细滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* 移动端禁止文字小于 14px */
@media (max-width: 520px) {
    body { font-size: 14px; }
}

/* =========================================================================
   3. 应用壳（APP 式居中容器）
   ========================================================================= */
.app-shell {
    position: relative;
    width: 100%;
    max-width: var(--shell-max);
    min-height: 100vh;
    margin: 0 auto;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 桌面端：限宽居中 + 圆角 + 阴影 + 顶部底部留白 */
@media (min-width: 521px) {
    .app-shell {
        min-height: auto;
        margin: 24px auto;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        border: 1px solid var(--border);
        height: calc(100vh - 48px);
        max-height: 920px;
    }
    body { padding: 0; }
}

/* =========================================================================
   4. 页头 .app-header
   ========================================================================= */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    /* 顶部安全区适配 */
    padding-top: env(safe-area-inset-top);
    box-shadow: var(--shadow);
}

.app-header .js-back,
.app-header .header-action {
    flex: 0 0 auto;
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    padding: 0;
}
.app-header .js-back:hover,
.app-header .header-action:hover {
    background: var(--bg-soft);
    color: var(--primary);
}

.app-header h1 {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    /* 让标题真正居中：左右按钮等宽占位 */
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

/* =========================================================================
   5. 主内容区 .app-content
   ========================================================================= */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space);
    /* 底部为导航栏留白 */
    padding-bottom: calc(var(--tabbar-h) + 20px);
    -webkit-overflow-scrolling: touch;
}

/* 无导航栏时去除底部留白 */
.app-content.no-tabbar { padding-bottom: var(--space); }

/* =========================================================================
   6. 底部导航 .app-tabbar
   ========================================================================= */
.app-tabbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: var(--shell-max);
    height: var(--tabbar-h);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 50;
    box-shadow: var(--shadow-tab);
    /* 底部安全区适配 */
    padding-bottom: env(safe-area-inset-bottom);
}

.app-tabbar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 11px;
    text-decoration: none;
    transition: color var(--transition);
    position: relative;
    /* 触摸目标 >=44px */
    min-height: 44px;
    padding: 4px 2px;
}
.app-tabbar .tab-item .icon { width: 22px; height: 22px; }
.app-tabbar .tab-item.active { color: var(--primary); }
.app-tabbar .tab-item:active { color: var(--primary-hover); }

/* 未读红点 */
.tab-item .badge-dot {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(14px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--radius-full);
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 600;
    border: 2px solid var(--bg-elevated);
}
.tab-item .badge-dot:empty { width: 8px; min-width: 8px; height: 8px; }

/* 桌面端导航栏随壳圆角 */
@media (min-width: 521px) {
    .app-tabbar {
        position: absolute;
        border-bottom-left-radius: var(--radius-lg);
        border-bottom-right-radius: var(--radius-lg);
        border-top: 1px solid var(--border);
    }
    .app-shell { position: relative; }
}

/* =========================================================================
   7. 组件 —— 卡片 .card
   ========================================================================= */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.card.flush { padding: 0; overflow: hidden; }
.card.link { cursor: pointer; }
.card.link:hover { box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: -6px; margin-bottom: 10px; }

/* =========================================================================
   8. 组件 —— 按钮 .btn
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-soft);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform 0.1s ease, opacity var(--transition);
    user-select: none;
    line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-soft); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { filter: brightness(0.95); color: #fff; }

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

.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-lg { min-height: 50px; padding: 14px 24px; font-size: 16px; }
.btn-icon { padding: 10px; min-width: 44px; }

/* =========================================================================
   9. 组件 —— 表单
   ========================================================================= */
.form-group { margin-bottom: 16px; }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.label .req { color: var(--danger); margin-left: 2px; }

.input, .textarea, .select {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    font-family: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-elevated);
    box-shadow: var(--ring);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c7c89' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; }
.input.is-invalid, .textarea.is-invalid, .select.is-invalid { border-color: var(--danger); }

/* 输入框带前缀图标 */
.input-group { position: relative; }
.input-group .icon-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 18px; height: 18px; pointer-events: none; }
.input-group .input.has-prefix { padding-left: 40px; }

/* =========================================================================
   10. 组件 —— 徽章 .badge / .tag / .order-status-badge
   ========================================================================= */
.badge, .tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    background: var(--bg-inset);
    color: var(--text-muted);
}
.badge .icon, .tag .icon { width: 13px; height: 13px; }
.badge-primary, .tag-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success, .tag-success { background: var(--success-soft); color: var(--success); }
.badge-danger, .tag-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning, .tag-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info, .tag-info { background: var(--info-soft); color: var(--info); }
.badge-muted, .tag-muted { background: var(--bg-inset); color: var(--text-muted); }

/* 订单状态徽章（按业务状态着色） */
.order-status-badge { font-size: 12px; padding: 3px 10px; }
.order-status-badge.status-pending_payment { background: var(--warning-soft); color: var(--warning); }
.order-status-badge.status-waiting_pool { background: var(--info-soft); color: var(--info); }
.order-status-badge.status-pending_confirm { background: var(--accent-soft); color: var(--accent); }
.order-status-badge.status-assigned,
.order-status-badge.status-in_progress { background: var(--primary-soft); color: var(--primary); }
.order-status-badge.status-completed { background: var(--success-soft); color: var(--success); }
.order-status-badge.status-cancelled,
.order-status-badge.status-refunded { background: var(--danger-soft); color: var(--danger); }

/* =========================================================================
   11. 组件 —— 头像 .avatar
   ========================================================================= */
.avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    border: 2px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 60px; height: 60px; font-size: 22px; }
/* 在线状态圆点 */
.avatar-wrap { position: relative; display: inline-block; }
.avatar-wrap .online-dot {
    position: absolute;
    bottom: 0; right: 0;
    width: 11px; height: 11px;
    background: var(--success);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-elevated);
}

/* =========================================================================
   12. 组件 —— 列表项 / 分割线
   ========================================================================= */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px var(--space);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background var(--transition);
    width: 100%;
    min-height: 48px;
    cursor: pointer;
    border-left: none; border-right: none; border-top: none;
    font-family: inherit;
    text-align: left;
}
.list-item:hover, .list-item:active { background: var(--bg-soft); }
.list-item .list-main { flex: 1; min-width: 0; }
.list-item .list-title { font-size: 15px; font-weight: 500; }
.list-item .list-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.list-item .list-meta { font-size: 12px; color: var(--text-faint); }
.list-item .chevron { color: var(--text-faint); flex: 0 0 auto; }

.divider { height: 1px; background: var(--border); border: none; margin: 12px 0; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12px; margin: 16px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* =========================================================================
   13. 组件 —— 空态 / 骨架屏
   ========================================================================= */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state .icon { width: 56px; height: 56px; color: var(--border-strong); margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; color: var(--text-muted); margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: var(--text-faint); }

/* 骨架屏加载态 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-soft) 25%, var(--bg-inset) 37%, var(--bg-soft) 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }
.skeleton-card { padding: var(--space); border-radius: var(--radius); margin-bottom: 12px; }
@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* =========================================================================
   14. 组件 —— Toast 提示
   ========================================================================= */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toast-in var(--transition-slow);
}
.toast .icon { flex: 0 0 auto; width: 18px; height: 18px; }
.toast-info { border-left-color: var(--info); } .toast-info .icon { color: var(--info); }
.toast-success { border-left-color: var(--success); } .toast-success .icon { color: var(--success); }
.toast-danger, .toast-error { border-left-color: var(--danger); } .toast-danger .icon, .toast-error .icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); } .toast-warning .icon { color: var(--warning); }
.toast.hide { animation: toast-out var(--transition-slow) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

/* =========================================================================
   15. 组件 —— 弹窗 .modal
   ========================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 20, 30, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fade-in var(--transition) ;
    backdrop-filter: blur(2px);
}
.modal {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modal-in var(--transition-slow);
    overflow: hidden;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px var(--space); border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-close { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: var(--radius-full); display: inline-flex; }
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-body { padding: var(--space); overflow-y: auto; }
.modal-footer { padding: 12px var(--space); border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* =========================================================================
   16. 组件 —— 警告条 .alert
   ========================================================================= */
.alert {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
}
.alert .icon { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.alert-info { background: var(--info-soft); border-color: var(--info-soft); color: var(--info); }
.alert-success { background: var(--success-soft); border-color: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-soft); color: var(--warning); }

/* =========================================================================
   17. 组件 —— 价格 .price
   ========================================================================= */
.price {
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}
.price .currency { font-size: 0.75em; margin-right: 1px; }
.price-lg { font-size: 24px; }
.price-sm { font-size: 14px; }

/* =========================================================================
   18. 组件 —— 聊天 .chat-bubble / .chat-input-bar
   ========================================================================= */
.chat-list { display: flex; flex-direction: column; gap: 2px; }
.chat-bubble-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-end; }
.chat-bubble-row.sent { flex-direction: row-reverse; }
.chat-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.chat-bubble-row.sent .chat-bubble {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
    border-bottom-right-radius: 4px;
}
.chat-bubble-row.received .chat-bubble { border-bottom-left-radius: 4px; }
.chat-bubble.text-system {
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--text-faint);
    font-size: 12px;
    text-align: center;
    max-width: 100%;
    align-self: center;
}
.chat-bubble img { border-radius: var(--radius-sm); margin-top: 4px; }
.chat-meta { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.chat-bubble-row.sent .chat-meta { text-align: right; }
.chat-read { color: var(--success); }
.chat-img-expired { color: var(--text-faint); font-size: 12px; font-style: italic; }

/* 聊天输入栏 */
.chat-input-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.chat-input-bar .chat-input {
    flex: 1;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 10px 16px;
    font-size: 15px;
    max-height: 120px;
    resize: none;
    min-height: 40px;
}
.chat-input-bar .chat-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.chat-input-bar .btn-icon-round {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--bg-soft);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.chat-input-bar .btn-icon-round:hover { color: var(--primary); }
.chat-input-bar .btn-send { background: var(--primary); color: var(--on-primary); }
.chat-input-bar .btn-send:disabled { opacity: 0.5; }

/* =========================================================================
   19. 组件 —— 图片网格 / 上传预览
   ========================================================================= */
.image-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.image-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-soft); }
.image-grid .img-cell { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft); }
.image-grid .img-cell img { width: 100%; height: 100%; object-fit: cover; }

.upload-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.upload-preview .preview-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); }
.upload-preview .preview-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .preview-remove {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.6);
    color: #fff; border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
}
.upload-preview .preview-remove .icon { width: 14px; height: 14px; }
.upload-preview .preview-add {
    aspect-ratio: 1; border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-faint); cursor: pointer; background: var(--bg-soft);
    transition: border-color var(--transition), color var(--transition);
}
.upload-preview .preview-add:hover { border-color: var(--primary); color: var(--primary); }

/* =========================================================================
   20. 组件 —— 开关 .switch
   ========================================================================= */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
    position: absolute; inset: 0;
    background: var(--bg-inset);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    transition: var(--transition);
    cursor: pointer;
}
.switch .slider::before {
    content: ''; position: absolute;
    width: 20px; height: 20px;
    left: 2px; top: 2px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.switch input:checked + .slider { background: var(--primary); border-color: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }

/* =========================================================================
   21. 组件 —— 横向标签页 .tabs
   ========================================================================= */
.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab {
    flex: 0 0 auto;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.tabs .tab.active { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.tabs .tab:hover:not(.active) { color: var(--text); }

/* =========================================================================
   22. 组件 —— 统计卡 .stat-card
   ========================================================================= */
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card .stat-icon { width: 22px; height: 22px; color: var(--text-muted); margin: 0 auto 6px; }

/* =========================================================================
   23. 组件 —— 表格 .table（移动端横向滚动）
   ========================================================================= */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--bg-soft); font-weight: 600; color: var(--text-muted); font-size: 13px; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-soft); }
.table .cell-main { font-weight: 500; }
.table .cell-sub { font-size: 12px; color: var(--text-muted); }

/* =========================================================================
   24. 工具类
   ========================================================================= */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.font-bold, .text-bold { font-weight: 600; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-start { display: flex; align-items: center; justify-content: flex-start; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.items-center { align-items: center; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.mono { font-variant-numeric: tabular-nums; }

/* =========================================================================
   25. 杂项 —— 分页 / 进度条
   ========================================================================= */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 16px 0; flex-wrap: wrap; }
.pagination .page-btn { min-width: 36px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--border); background: var(--bg-elevated); border-radius: var(--radius-sm); color: var(--text); cursor: pointer; font-size: 14px; }
.pagination .page-btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.pagination .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.progress { height: 6px; background: var(--bg-inset); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: var(--radius-full); transition: width var(--transition-slow); }

/* 锚点跳转占位，避免被 sticky 页头遮挡 */
.anchor { display: block; position: relative; top: calc(var(--header-h) * -1); visibility: hidden; }

/* =========================================================================
   26. 登录/注册布局（auth）—— 居中卡片式
   ========================================================================= */
.auth-wrap {
    min-height: 100vh;
    max-width: 420px;
    margin: 0 auto;
    padding: 40px 24px calc(40px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}
.auth-theme-btn {
    position: absolute;
    top: 16px; right: 16px;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}
.auth-theme-btn:hover { background: var(--bg-soft); color: var(--primary); }

.auth-brand { text-align: center; margin-bottom: 32px; }
.auth-logo {
    width: 80px; height: 80px;
    margin: 0 auto 16px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), #ffd58a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-primary);
    box-shadow: 0 8px 24px rgba(232, 154, 47, 0.35);
}
.auth-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.02em;
}
.auth-subtitle {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-muted);
}
.auth-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-content .card { padding: 24px var(--space); }
.auth-footer { text-align: center; margin-top: 24px; }
.auth-home-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    transition: background var(--transition), color var(--transition);
}
.auth-home-link:hover { background: var(--bg-soft); color: var(--primary); }
