﻿/* ==========================================================
   盘古引擎系统 - 公共样式 main.css
   iOS 设计语言 v3 — 毛玻璃 · 圆角 · 轻阴影 · 弹性动画
   ========================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ==========================================================
   默认变量（晨曦白）- iOS 设计令牌
   ========================================================== */
:root {
    /* === iOS 主色系 === */
    --primary: #007AFF;
    --primary-dark: #0056CC;
    --primary-light: #4DA3FF;
    --primary-rgb: 0, 122, 255;

    --secondary: #5AC8FA;
    --secondary-dark: #007AFF;
    --secondary-rgb: 90, 200, 250;

    --accent: #5AC8FA;
    --accent-2: #007AFF;
    --accent-rgb: 90, 200, 250;

    /* === 金额语义色（财务数据专用） === */
    --amount-income: #34C759;     /* 收入/正向 */
    --amount-expense: #FF3B30;    /* 支出/负向 */
    --amount-neutral: #1C1C1E;    /* 中性汇总（使用主文字色） */
    --amount-income-rgb: 52, 199, 89;
    --amount-expense-rgb: 255, 59, 48;

    /* === iOS 系统背景色（浅灰基底，非纯白）=== */
    --bg-1: #F2F2F7;
    --bg-2: #E5E5EA;
    --bg-3: #D1D1D6;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F9F9FB;
    --bg-input: #F2F2F7;
    --bg-input-focus: #FFFFFF;
    --bg-overlay: rgba(0,0,0,0.35);
    --bg-loading: rgba(242,242,247,0.88);
    --bg-nav: rgba(255,255,255,0.82);
    --bg-table-head: #F2F2F7;
    --bg-table-stripe: rgba(0,0,0,0.018);
    --bg-table-wrap: rgba(242,242,247,0.85);
    --bg-modal: #FFFFFF;
    --bg-toast: #FFFFFF;

    /* === iOS 文字色（4级灰阶 — 参考竞品对比度优化） === */
    --text-main: #1C1C1E;     /* 一级：主标题、金额、核心数据 */
    --text-sub: #636366;      /* 二级：副标题、列表项、描述 */
    --text-mute: #8E8E93;     /* 三级：辅助信息、时间戳、百分比 */
    --text-faint: #C7C7CC;    /* 四级：占位符、禁用态、极弱提示 */
    --text-bright: #1C1C1E;   /* 强调：页面标题、KPI数值 */
    --text-link: #007AFF;
    --text-on-primary: #FFFFFF;

    /* === iOS 面板色 === */
    --panel-1: #FFFFFF;
    --panel-2: #F9F9FB;
    --surface-soft: rgba(0,0,0,0.03);
    --surface-subtle: rgba(0,0,0,0.05);
    --surface-subtle-hover: rgba(0,0,0,0.08);

    /* === iOS 边框 === */
    --border: rgba(0,0,0,0.06);
    --border-soft: rgba(0,0,0,0.04);
    --border-input: rgba(0,0,0,0.10);
    --border-disabled: rgba(0,0,0,0.12);

    /* === iOS 阴影（大半径、低透明度）=== */
    --shadow-card: 0 1px 4px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.04);
    --shadow-dropdown: 0 8px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.16), 0 8px 24px rgba(0,0,0,0.06);
    --shadow-toast: 0 4px 20px rgba(0,0,0,0.10);

    /* === iOS 语义色 === */
    --red: #FF3B30;
    --red-rgb: 255, 59, 48;
    --green: #34C759;
    --green-rgb: 52, 199, 89;
    --blue: #007AFF;
    --blue-rgb: 0, 122, 255;
    --orange: #FF9500;
    --orange-rgb: 255, 149, 0;
    --purple: #AF52DE;
    --purple-rgb: 175, 82, 222;
    --red-dark: #C62828;
    --red-dark-rgb: 198, 40, 40;
    --cyan: #22D3EE;
    --cyan-rgb: 34, 211, 238;

    --text-mute-rgb: 142, 142, 147;
    --surface-source-header: #F2F2F7;
    --border-source-header: rgba(0,0,0,0.06);

    --color-error: #FF3B30;
    --color-error-rgb: 255, 59, 48;
    --color-error-soft: rgba(255,59,48,0.08);
    --color-success: #34C759;
    --color-success-rgb: 52, 199, 89;
    --color-success-soft: rgba(52,199,89,0.08);
    --color-warning: #FF9500;
    --color-warning-rgb: 255, 149, 0;
    --color-warning-soft: rgba(255,149,0,0.08);
    --color-info: #007AFF;
    --color-info-rgb: 0, 122, 255;
    --color-info-soft: rgba(0,122,255,0.08);
    --color-purple: #AF52DE;
    --color-purple-rgb: 175, 82, 222;
    --color-purple-soft: rgba(175,82,222,0.08);

    /* === iOS 间距 === */
    --space-2: 8px;
    --space-4: 16px;
    --space-5: 20px;

    /* === iOS 字号（标准化排版体系） === */
    --fs-3xs: 9px;        /* 极小标注（日历格子、环形标签） */
    --fs-2xs: 10px;       /* 微标签、徽章 */
    --fs-xs: 11px;        /* 辅助文字、时间戳 */
    --fs-sm: 12px;        /* 标注、表头、caption */
    --fs-base: 14px;      /* 正文基准、导航、表格（最常用） */
    --fs-md: 15px;        /* 强调正文、分类名 */
    --fs-lg: 16px;        /* 按钮、卡片标题、高亮 */
    --fs-xl: 17px;        /* 副标题、金额、工具栏 */
    --fs-2xl: 19px;       /* 区块标题、小标题 */
    --fs-3xl: 23px;       /* 页面标题、核心数值 */
    --fs-4xl: 28px;       /* 大号 KPI */
    --fs-5xl: 32px;       /* Hero 金额、计时器 */
    --fs-6xl: 42px;       /* 超大显示（极少使用） */
    --fs-7xl: 64px;       /* 计时器/特殊大数字 */
    --fs-8xl: 88px;       /* 错误页装饰大数字（移动端） */
    --fs-9xl: 120px;      /* 错误页装饰大数字（桌面端） */

    /* === iOS 字重（标准化） === */
    --fw-light: 300;      /* 细体（计时器等特殊场景） */
    --fw-normal: 400;     /* 正文、描述 */
    --fw-medium: 500;     /* 标签、次要强调 */
    --fw-semibold: 600;   /* 标题、分类名、按钮 */
    --fw-bold: 600;       /* 金额、KPI、页面标题（由700降为semibold，参考竞品去黑粗） */
    --fw-extrabold: 700;  /* Hero 大数字（由800降为bold，克制） */

    /* === 行高（标准化） — 参考iOS HIG + 竞品分析 === */
    --lh-tight: 1.0;      /* 大数字、Hero金额（贴紧单行） */
    --lh-heading: 1.25;   /* 标题、导航、卡片标题 */
    --lh-body: 1.5;       /* 正文、列表项、描述 */
    --lh-relaxed: 1.65;   /* 小字描述、提示文本（舒展阅读） */

    /* === 字间距（标准化） — CJK + 数字优化 === */
    --ls-tight: -0.02em;  /* 大数字、金额（收紧视觉一体感） */
    --ls-normal: 0;       /* 正文、中文（默认） */
    --ls-wide: 0.01em;    /* 标签、按钮、次级标题 */
    --ls-wider: 0.02em;   /* 小标签、KPI标签、表头 */
    --ls-widest: 0.05em;  /* 徽章、全大写、极小标注 */

    /* === 字体族（标准化） === */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    --font-numeric: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', sans-serif;

    /* === 数字排版（财务数据对齐） === */
    --num-tnum: tabular-nums;
    --num-features: 'tnum';

    /* === 图标背景透明度（随主题调整） === */
    --icon-bg-pct: 13%;   /* 图标背景色混合比例 */

    /* === iOS 圆角 === */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;
}

/* ==========================================================
   主题皮肤变量
   ========================================================== */
html[data-theme="light"] {
    --primary: #007AFF;
    --primary-dark: #0056CC;
    --primary-light: #4DA3FF;
    --primary-rgb: 0, 122, 255;
    --secondary: #5AC8FA;
    --secondary-dark: #007AFF;
    --secondary-rgb: 90, 200, 250;
    --accent: #5AC8FA;
    --accent-2: #007AFF;
    --accent-rgb: 90, 200, 250;
    --amount-income: #34C759;
    --amount-expense: #FF3B30;
    --amount-neutral: #1C1C1E;
    --amount-income-rgb: 52, 199, 89;
    --amount-expense-rgb: 255, 59, 48;
    --bg-1: #F2F2F7;
    --bg-2: #E5E5EA;
    --bg-3: #D1D1D6;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F9F9FB;
    --bg-input: #F2F2F7;
    --bg-input-focus: #FFFFFF;
    --bg-overlay: rgba(0,0,0,0.35);
    --bg-loading: rgba(242,242,247,0.88);
    --bg-nav: rgba(255,255,255,0.82);
    --bg-table-head: #F2F2F7;
    --bg-table-stripe: rgba(0,0,0,0.018);
    --bg-table-wrap: rgba(242,242,247,0.85);
    --bg-modal: #FFFFFF;
    --bg-toast: #FFFFFF;
    --text-main: #1C1C1E;
    --text-sub: #636366;
    --text-mute: #8E8E93;
    --text-faint: #C7C7CC;
    --text-bright: #1C1C1E;
    --text-link: #007AFF;
    --text-on-primary: #FFFFFF;
    --panel-1: #FFFFFF;
    --panel-2: #F9F9FB;
    --surface-soft: rgba(0,0,0,0.03);
    --surface-subtle: rgba(0,0,0,0.05);
    --surface-subtle-hover: rgba(0,0,0,0.08);
    --border: rgba(0,0,0,0.06);
    --border-soft: rgba(0,0,0,0.04);
    --border-input: rgba(0,0,0,0.10);
    --border-disabled: rgba(0,0,0,0.12);
    --shadow-card: 0 1px 4px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.08), 0 8px 32px rgba(0,0,0,0.04);
    --shadow-dropdown: 0 8px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.16), 0 8px 24px rgba(0,0,0,0.06);
    --shadow-toast: 0 4px 20px rgba(0,0,0,0.10);
}
html[data-theme="champagne"] {
    /* === iOS 暖金主色系 === */
    --primary: #C9A227;
    --primary-dark: #A88420;
    --primary-light: #E3C76B;
    --primary-rgb: 201, 162, 39;

    --secondary: #E3C76B;
    --secondary-dark: #C9A227;
    --secondary-rgb: 227, 199, 107;

    --accent: #E3C76B;
    --accent-2: #C9A227;
    --accent-rgb: 227, 199, 107;
    --amount-income: #6BA84F;
    --amount-expense: #D4534A;
    --amount-neutral: #3D3528;
    --amount-income-rgb: 107, 168, 79;
    --amount-expense-rgb: 212, 83, 74;

    /* === iOS 暖色背景 === */
    --bg-1: #F7F3EC;
    --bg-2: #EDE5D4;
    --bg-3: #DDD2BB;
    --bg-card: #FFFDF8;
    --bg-card-hover: #F7F3EC;
    --bg-input: #EDE5D4;
    --bg-input-focus: #FFFDF8;
    --bg-overlay: rgba(0,0,0,0.35);
    --bg-loading: rgba(247,243,236,0.88);
    --bg-nav: rgba(255,253,248,0.82);
    --bg-table-head: #EDE5D4;
    --bg-table-stripe: rgba(122,100,50,0.025);
    --bg-table-wrap: rgba(247,243,236,0.85);
    --bg-modal: #FFFDF8;
    --bg-toast: #FFFDF8;

    /* === iOS 暖棕文字（4级灰阶 — 对比度优化） === */
    --text-main: #3D3528;
    --text-sub: #7A6E5A;
    --text-mute: #9A8B72;
    --text-faint: #BCAA88;
    --text-bright: #1E1810;
    --text-link: #C9A227;
    --text-on-primary: #FFFDF8;

    /* === iOS 暖色面板 === */
    --panel-1: #FFFDF8;
    --panel-2: #F7F3EC;
    --surface-soft: rgba(122,100,50,0.03);
    --surface-subtle: rgba(122,100,50,0.05);
    --surface-subtle-hover: rgba(122,100,50,0.08);

    /* === iOS 暖色边框 === */
    --border: rgba(122,100,50,0.08);
    --border-soft: rgba(122,100,50,0.05);
    --border-input: rgba(122,100,50,0.12);
    --border-disabled: rgba(122,100,50,0.14);

    /* === iOS 暖色阴影 === */
    --shadow-card: 0 1px 4px rgba(122,100,50,0.06), 0 2px 8px rgba(122,100,50,0.04);
    --shadow-card-hover: 0 4px 16px rgba(122,100,50,0.10), 0 8px 32px rgba(122,100,50,0.04);
    --shadow-dropdown: 0 8px 32px rgba(122,100,50,0.12), 0 4px 12px rgba(122,100,50,0.05);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.18), 0 8px 24px rgba(122,100,50,0.08);
    --shadow-toast: 0 4px 20px rgba(122,100,50,0.10);

    /* === iOS 暖色语义色 === */
    --red: #D4534A;
    --red-rgb: 212, 83, 74;
    --green: #6BA84F;
    --green-rgb: 107, 168, 79;
    --blue: #4A90A4;
    --blue-rgb: 74, 144, 164;
    --orange: #D9941A;
    --orange-rgb: 217, 148, 26;
    --purple: #A07CC4;
    --purple-rgb: 160, 124, 196;

    --color-error: #D4534A;
    --color-error-rgb: 212, 83, 74;
    --color-error-soft: rgba(212,83,74,0.08);
    --color-success: #6BA84F;
    --color-success-rgb: 107, 168, 79;
    --color-success-soft: rgba(107,168,79,0.08);
    --color-warning: #D9941A;
    --color-warning-rgb: 217, 148, 26;
    --color-warning-soft: rgba(217,148,26,0.08);
    --color-info: #4A90A4;
    --color-info-rgb: 74, 144, 164;
    --color-info-soft: rgba(74,144,164,0.08);
    --color-purple: #A07CC4;
    --color-purple-rgb: 160, 124, 196;
    --color-purple-soft: rgba(160,124,196,0.08);

    --red-dark: #B84C45;
    --red-dark-rgb: 184, 76, 69;
    --cyan: #5BC0BE;
    --cyan-rgb: 91, 192, 190;

    --text-mute-rgb: 154, 139, 114;
    --surface-source-header: #EDE5D4;
    --border-source-header: rgba(122,100,50,0.08);

    /* === 香槟金图标配色调整 === */
    --icon-bg-pct: 10%;   /* 降低图标背景饱和度，融入暖色基底 */
}

/* ==========================================================
   基础排版 & 布局
   ========================================================== */
html, body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    color: var(--text-main);
    background: var(--bg-1);
    line-height: var(--lh-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ══════════════════════════════════════════════════════════════
   排版工具类（标准化语义体系）
   ────────────────────────────────────────────────────────────────
   设计原则：
   • 数值/金额 → fw-bold（核心数据必须醒目）
   • 标题/区块 → fw-semibold（层次清晰但不喧宾夺主）
   • 标签/描述 → fw-medium（辅助信息柔和呈现）
   • 正文/默认 → fw-normal（基准阅读体验）
   • Hero大数字 → fw-extrabold（预算总额等极少使用）
   • 计时器显示 → fw-light（超大数字专用，仅限 timer）
   • 激活状态 → fw-semibold（统一规则，不用 fw-bold）
   ══════════════════════════════════════════════════════════════ */

/* ── 显示层（Hero / 大数字）── */
.text-display { font-size: var(--fs-5xl); font-weight: var(--fw-extrabold); color: var(--text-main); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }

/* ── 标题层 ── */
.text-heading { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--text-main); line-height: var(--lh-heading); letter-spacing: var(--ls-normal); }
.text-section { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--text-main); line-height: var(--lh-heading); letter-spacing: var(--ls-normal); }
.text-title   { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-main); line-height: var(--lh-heading); letter-spacing: var(--ls-normal); }
.text-subtitle { font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-main); line-height: var(--lh-heading); letter-spacing: var(--ls-normal); }

/* ── 数值层 ── */
.text-stat    { font-size: var(--fs-4xl); font-weight: var(--fw-bold); color: var(--text-main); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.text-stat-sm { font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--text-main); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.text-amount  { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-main); line-height: var(--lh-heading); letter-spacing: var(--ls-tight); }
.text-amount-sm { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-main); line-height: var(--lh-heading); letter-spacing: var(--ls-tight); }

/* ── 正文层 ── */
.text-body    { font-size: var(--fs-base); font-weight: var(--fw-normal); color: var(--text-sub); line-height: var(--lh-body); letter-spacing: var(--ls-normal); }
.text-body-em { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-main); line-height: var(--lh-body); letter-spacing: var(--ls-normal); }
.text-category { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--text-main); line-height: var(--lh-body); letter-spacing: var(--ls-normal); }

/* ── 标注层 ── */
.text-label   { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-mute); line-height: var(--lh-body); letter-spacing: var(--ls-wide); }
.text-micro   { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-mute); line-height: var(--lh-body); letter-spacing: var(--ls-normal); }
.text-mute    { font-size: var(--fs-xs); font-weight: var(--fw-normal); color: var(--text-mute); line-height: var(--lh-body); letter-spacing: var(--ls-normal); }
.text-faint   { font-size: var(--fs-xs); font-weight: var(--fw-normal); color: var(--text-faint); line-height: var(--lh-body); letter-spacing: var(--ls-normal); }
.text-badge   { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); line-height: var(--lh-body); letter-spacing: var(--ls-wide); }

/* ── 功能类 ── */
.text-num     { font-variant-numeric: var(--num-tnum); font-feature-settings: var(--num-features); }
.text-active  { font-weight: var(--fw-semibold); }

/* ── 图标背景容器（主题感知） ── */
/* 全局统一：r9 圆角 + 12% 主题色浅底（与 icons.js renderIconBadge 规范一致） */
.pangu-icon-bg {
    border-radius: 9px;
    background: color-mix(in srgb, var(--icon-color, #B0BEC5) var(--icon-bg-pct, 12%), transparent);
}
html[data-theme="champagne"] .pangu-icon-bg {
    background: color-mix(in srgb, var(--icon-color, #B0BEC5) var(--icon-bg-pct, 12%), var(--panel-1) 3%);
}

/* ==========================================================
   导航栏 — iOS 毛玻璃
   ========================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 52px;
    background: var(--bg-nav);
    border-bottom: 0.5px solid var(--border);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-left { display: flex; align-items: center; gap: 16px; }
.navbar-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--primary);
    letter-spacing: var(--ls-wide);
    white-space: nowrap;
}
.navbar-nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    color: var(--text-sub);
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--primary); background: rgba(var(--primary-rgb), 0.08); }
.nav-link.active { font-weight: var(--fw-semibold); }
.nav-link-icon { flex-shrink: 0; opacity: 0.65; transition: opacity 0.2s; }
.nav-link:hover .nav-link-icon, .nav-link.active .nav-link-icon { opacity: 1; }
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 6px;
    box-shadow: var(--shadow-dropdown);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    font-size: var(--fs-base);
    transition: all 0.15s;
}
.nav-dropdown-item:hover, .nav-dropdown-item.active { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }
.nav-dropdown-item-icon { flex-shrink: 0; opacity: 0.55; transition: opacity 0.15s; }
.nav-dropdown-item:hover .nav-dropdown-item-icon, .nav-dropdown-item.active .nav-dropdown-item-icon { opacity: 1; }
.navbar-right { display: flex; align-items: center; gap: 10px; }
.navbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: rgba(var(--primary-rgb), 0.06);
}
.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
}
.user-name { font-size: var(--fs-base); color: var(--text-main); font-weight: var(--fw-medium); }
/* 皮肤切换器 */
.theme-switcher { position: relative; }
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 0.5px solid var(--border);
    background: var(--surface-subtle);
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-family: inherit;
    line-height: var(--lh-tight);
    transition: all 0.2s;
}
.theme-toggle-btn:hover { background: var(--surface-subtle-hover); }
.theme-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.theme-arrow { color: var(--text-mute); flex-shrink: 0; }
#themeName { line-height: var(--lh-tight); transform: translateY(-1px); }
.theme-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    min-width: 140px;
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4px;
    box-shadow: var(--shadow-dropdown);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 200;
}
.theme-dropdown.show { display: block; }
.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--fs-base);
    font-family: inherit;
    transition: all 0.15s;
    text-align: left;
}
.theme-option:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--primary); }

/* ── PC 内容区：自适应填充侧边栏右侧全部宽度（不再居中留白）── */
.page-container {
    flex: 1 1 auto;        /* 作为 pc-layout 的 flex 子项，撑满剩余宽度 */
    min-width: 0;          /* 防止内部宽表格/网格把布局撑破 */
    max-width: none;       /* 取消 1400px 上限，内容铺满红框区域 */
    margin: 0;             /* 改为左对齐贴合侧边栏，而非居中 */
    padding: 24px 32px;
}
.container-fluid { width: 100%; max-width: none; }

/* 大屏（≥1800px）：加宽左右留白，阅读更舒展 */
@media (min-width: 1800px) {
    .page-container { padding: 28px 48px; }
}
/* 超大屏（≥2400px）：避免单行过长，内容上限留白居中 */
@media (min-width: 2400px) {
    .page-container { max-width: 2000px; margin: 0 auto; padding: 32px 56px; }
}

/* ==========================================================
   分区标题 (section-header) — iOS 风格，原生长于 growth.html，提取为全局组件
   用于多页面区块标题：「全局概览」「成长记录」「债务总览」「习惯中心」等
   ========================================================== */
.section-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px; margin-top: 12px;
    padding: 12px 0;
    border-bottom: 0.5px solid var(--border-soft);
}
.section-header:first-of-type { margin-top: 0; }
.section-header-accent {
    width: 4px; height: 22px; border-radius: 2px; flex-shrink: 0;
}
.section-header-accent.overview { background: var(--text-mute); }
.section-header-accent.growth { background: var(--green); }
.section-header-accent.finance { background: var(--primary); }
.section-header-accent.insight { background: var(--purple); }
.section-header-accent.debt { background: var(--red); }
.section-header-accent.habit { background: var(--blue); }
.section-header-label {
    font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-main); letter-spacing: var(--ls-tight);
}
.section-header-desc {
    font-size: var(--fs-sm); color: var(--text-mute); margin-left: 4px;
}
@media (max-width: 767px) {
    .section-header { padding: 8px 0; margin-bottom: 10px; }
    .section-header-label { font-size: var(--fs-md); }
}

/* ==========================================================
   按钮 — iOS 风格：圆润 · 弹性动画 · 触控友好
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.btn:active { transform: scale(0.96); transition: transform 0.1s; }
.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
    transform: translateY(-1px);
}
.btn-primary:active { box-shadow: 0 1px 4px rgba(var(--primary-rgb), 0.2); }
.btn-ghost {
    background: var(--surface-subtle);
    color: var(--text-sub);
    border: 0.5px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-subtle-hover); color: var(--text-main); }
.btn-danger {
    background: var(--red);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(var(--red-rgb), 0.25);
}
.btn-danger:hover {
    opacity: 0.92;
    box-shadow: 0 4px 16px rgba(var(--red-rgb), 0.35);
    transform: translateY(-1px);
}
.btn-sm { padding: 7px 16px; font-size: var(--fs-base); border-radius: var(--radius-pill); }
.btn-loading { opacity: 0.6; pointer-events: none; }

/* ==========================================================
   表单 — iOS 风格：大圆角 · 清晰聚焦环 · 充分间距
   ========================================================== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: var(--fs-base);
    color: var(--text-sub);
    margin-bottom: 6px;
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-wide);
}
/* ── 全局 select 基础样式（确保所有下拉框皮肤一致）── */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 10px 30px 10px 12px;
    border: 0.5px solid var(--border-input);
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svgwidth='12height='12viewBox='0 0 24 24fill='nonestroke='%238e8e93stroke-width='2stroke-linecap='roundstroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    color: var(--text-main);
    font-size: var(--fs-md);
    font-family: inherit;
    cursor: pointer;
    accent-color: var(--primary);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    box-sizing: border-box;
}
select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-input-focus);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.10);
}
select:hover:not(:focus) {
    border-color: rgba(var(--primary-rgb), 0.25);
}
select option {
    background: var(--bg-modal);
    color: var(--text-main);
}
select option:checked {
    color: var(--primary);
}
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 0.5px solid var(--border-input);
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    color: var(--text-main);
    font-size: var(--fs-lg);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
/* select 统一自定义箭头 + 主题色选中标记（兼容原生 option 渲染）*/
.form-select {
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svgwidth='12height='12viewBox='0 0 24 24fill='nonestroke='%238e8e93stroke-width='2stroke-linecap='roundstroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.10);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-mute); }
.form-input:hover:not(:focus), .form-select:hover:not(:focus), .form-textarea:hover:not(:focus) {
    border-color: rgba(var(--primary-rgb), 0.25);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.required { color: var(--color-error); margin-left: 2px; }
.pwd-wrap { position: relative; }
.pwd-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--fs-2xl);
    color: var(--text-mute);
    padding: 4px;
    border-radius: 50%;
    transition: color 0.15s;
}
.pwd-toggle:hover { color: var(--text-sub); }

/* ==========================================================
   弹窗 — iOS 风格：毛玻璃遮罩 · 大圆角 · 弹性入场
   ========================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-modal);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    width: 500px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    border: 0.5px solid var(--border);
}
.modal-sm { width: 420px; }
.modal-lg { width: 700px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 0.5px solid var(--border-soft);
}
.modal-title { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--text-bright); letter-spacing: var(--ls-wide); }
.modal-close {
    background: var(--surface-subtle);
    border: none;
    color: var(--text-mute);
    font-size: var(--fs-3xl);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.modal-close:hover { background: var(--surface-subtle-hover); color: var(--text-main); }
.modal-body { margin-bottom: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; }

/* ==========================================================
   分类管理 — 全屏面板（对标竞品清爽风格）
   ========================================================== */
.cat-mgr-overlay {
    display: none; position: fixed; inset: 0; z-index: 1100;
    background: var(--bg-modal);
    flex-direction: column;
    animation: catMgrSlideIn 0.25s ease-out;
}
.cat-mgr-overlay.show { display: flex; }
@keyframes catMgrSlideIn {
    from { transform: translateX(100%); opacity: 0.6; }
    to { transform: translateX(0); opacity: 1; }
}
.cat-mgr-shell {
    display: flex; flex-direction: column; height: 100%; width: 100%;
    max-width: 480px; margin: 0 auto;
}

/* ── 导航栏 ── */
.cat-mgr-nav {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; flex-shrink: 0;
    border-bottom: 0.5px solid var(--border-soft);
}
.cat-mgr-back {
    width: 36px; height: 36px; border: none; border-radius: 50%;
    background: var(--surface-subtle); color: var(--text-main);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.cat-mgr-back:hover { background: var(--surface-subtle-hover); }
.cat-mgr-nav-title {
    font-size: var(--fs-2xl); font-weight: var(--fw-semibold); color: var(--text-main); flex: 1;
}

/* ── 滚动列表区 ── */
.cat-mgr-body {
    flex: 1; overflow-y: auto; padding: 8px 0 100px;
    -webkit-overflow-scrolling: touch;
}

/* ── 分组（一级 + 子级容器） ── */
.cat-mgr-group { display: flex; flex-direction: column; }
.cat-mgr-group + .cat-mgr-group { margin-top: 8px; }

/* ── 行（通用） ── */
.cat-mgr-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--bg-modal);
    transition: background 0.15s; position: relative;
}
.cat-mgr-row:hover { background: var(--surface-subtle); }
.cat-mgr-row.dragging { opacity: 0.4; }
.cat-mgr-row.drag-over { box-shadow: inset 0 2px 0 var(--primary); }
.cat-mgr-row.over .cat-mgr-label { color: var(--color-error); }

/* ── 左侧区域 ── */
.cat-mgr-left {
    display: flex; align-items: center; gap: 12px;
    flex: 1; min-width: 0;
}
.cat-mgr-chevron {
    width: 24px; height: 24px; border: none; background: transparent;
    color: var(--text-mute); cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s; border-radius: var(--radius-sm);
}
.cat-mgr-chevron:hover { color: var(--primary); }
.cat-mgr-chevron-spacer { width: 24px; flex-shrink: 0; }

/* ── 图标徽章 ── 统一使用 .pangu-icon-bg 规范（12% 主题色浅底） ── */
.cat-mgr-badge {
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.cat-mgr-badge.sm {
    /* sm 尺寸由内层 .pangu-icon-bg 的 bgSize 控制 */
}
.cat-mgr-badge .pangu-icon { color: inherit; }

/* ── 分类文字 ── */
.cat-mgr-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cat-mgr-label {
    font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-mgr-label.sm { font-size: var(--fs-md); font-weight: var(--fw-normal); color: var(--text-sub); }
.cat-mgr-budget { display: flex; align-items: center; gap: 4px; }
.cat-mgr-budget-text {
    font-size: var(--fs-xs); color: var(--text-mute);
}
.cat-mgr-budget-text.over { color: var(--color-error); font-weight: var(--fw-semibold); }

/* ── 右侧操作区 ── */
.cat-mgr-right {
    display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}
.cat-mgr-act {
    width: 34px; height: 34px; border: none; border-radius: 8px;
    background: transparent; color: var(--text-mute); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.cat-mgr-act:hover { background: var(--surface-subtle-hover); color: var(--primary); }
.cat-mgr-act.del:hover { color: var(--color-error); background: rgba(var(--color-error-rgb), 0.08); }
.cat-mgr-act:disabled { opacity: 0.2; cursor: not-allowed; }
.cat-mgr-act:disabled:hover { background: transparent; color: var(--text-mute); }
.cat-mgr-drag {
    width: 34px; height: 34px; border: none; border-radius: 8px;
    background: transparent; color: var(--text-mute); cursor: grab;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.cat-mgr-drag:hover { color: var(--text-sub); background: var(--surface-subtle-hover); }
.cat-mgr-drag:active { cursor: grabbing; }

/* ── 二级分类容器 ── */
.cat-mgr-sub {
    display: flex; flex-direction: column;
}
.cat-mgr-l2 {
    padding-left: 52px;
}
/* L2 分类的 badge 尺寸由内层 .pangu-icon-bg bgSize 控制，无需外层覆盖 */

/* ── 新建二级分类按钮 ── */
.cat-mgr-add-sub {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 16px 10px 52px;
    border: none; background: transparent;
    color: var(--primary); font-size: var(--fs-md);
    cursor: pointer; transition: all 0.15s;
}
.cat-mgr-add-sub:hover { background: var(--surface-subtle); }
.cat-mgr-add-sub svg { flex-shrink: 0; }

/* ── 底部操作栏 ── */
.cat-mgr-foot {
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--bg-modal);
    border-top: 0.5px solid var(--border-soft);
    max-width: 480px; margin: 0 auto;
}
.cat-mgr-foot-add {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px; border: none; border-radius: var(--radius-md);
    background: var(--primary); color: var(--text-on-primary); font-size: var(--fs-lg); font-weight: var(--fw-semibold);
    cursor: pointer; transition: all 0.2s;
}
.cat-mgr-foot-add:hover { opacity: 0.9; transform: translateY(-1px); }
.cat-mgr-foot-add svg { flex-shrink: 0; }

/* ── 表单模式 ── */
.cat-mgr-form { display: flex; flex-direction: column; gap: 20px; padding: 16px 20px 8px; }
.cat-mgr-icon-row { display: flex; justify-content: center; }
.cat-mgr-icon-preview {
    width: 72px; height: 72px; border-radius: var(--radius-lg);
    background: var(--surface-subtle); border: 1.5px dashed var(--border);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; gap: 2px;
}
.cat-mgr-icon-preview:hover { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.06); }
.cat-mgr-icon-preview .pangu-icon { color: inherit; }
.cat-mgr-icon-hint { font-size: var(--fs-2xs); color: var(--text-mute); }

.cat-mgr-icon-picker {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
    padding: 12px; background: var(--surface-subtle); border-radius: var(--radius-md);
    max-height: 240px; overflow-y: auto;
}
.cat-mgr-icon-opt {
    width: 100%; aspect-ratio: 1; border: 1.5px solid transparent; border-radius: var(--radius-sm);
    background: var(--bg-modal); cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.cat-mgr-icon-opt:hover { border-color: var(--primary); }
.cat-mgr-icon-opt.active { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.08); }
.cat-mgr-icon-opt .pangu-icon { color: inherit; }
.cat-mgr-icon-opt.active .pangu-icon { color: inherit; }

.cat-mgr-field { display: flex; flex-direction: column; gap: 6px; }
.cat-mgr-parent-tag {
    font-size: var(--fs-base); color: var(--text-mute);
    padding: 10px 16px; background: var(--surface-subtle);
    border-radius: var(--radius-sm);
}
.cat-mgr-parent-name { color: var(--primary); font-weight: var(--fw-medium); }
.cat-mgr-form-delete {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 8px; padding: 12px;
    border: none; border-radius: var(--radius-md);
    background: rgba(var(--color-error-rgb), 0.06); color: var(--color-error);
    font-size: var(--fs-md); cursor: pointer; transition: all 0.15s;
}
.cat-mgr-form-delete:hover { background: rgba(var(--color-error-rgb), 0.12); }
.cat-mgr-groups { display: flex; flex-direction: column; }

/* ==========================================================
   卡片 — iOS 风格：大圆角 · 微阴影 · 轻悬停
   ========================================================== */
.card {
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
                border-color 0.3s;
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(var(--primary-rgb), 0.10);
    transform: translateY(-1px);
}
.card-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--text-bright);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: var(--ls-wide);
}

/* ==========================================================
   KPI 卡片 — iOS 风格：清爽 · 指标突出 · 微动效
   ========================================================== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi-card {
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.25), transparent);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 3px 3px 0 0;
}
.kpi-card:hover {
    border-color: rgba(var(--primary-rgb), 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}
.kpi-card:hover::before { opacity: 1; }
.kpi-label { font-size: var(--fs-sm); color: var(--text-sub); margin-bottom: 8px; font-weight: var(--fw-medium); letter-spacing: var(--ls-wider); }
.kpi-value { font-size: var(--fs-4xl); font-weight: var(--fw-bold); color: var(--text-bright); font-family: var(--font-numeric); letter-spacing: var(--ls-tight); }
.kpi-bottom { font-size: var(--fs-xs); color: var(--text-mute); margin-top: 8px; }
.kpi-card.highlight { border-color: rgba(var(--color-error-rgb), 0.25); }

/* ==========================================================
   工具栏 — iOS 风格
   ========================================================== */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-title { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--text-bright); letter-spacing: var(--ls-tight); }

/* ==========================================================
   选项卡 / 维度切换 — iOS 分段控件风格
   ========================================================== */
.tab-bar, .dim-bar { display: inline-flex; gap: 0; margin-bottom: 14px; background: var(--surface-subtle); border-radius: var(--radius-pill); padding: 3px; }
.tab-btn, .dim-btn {
    padding: 8px 22px;
    border-radius: var(--radius-pill);
    border: none;
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    white-space: nowrap;
}
.tab-btn:hover, .dim-btn:hover { color: var(--text-main); }
.tab-btn.active, .dim-btn.active {
    background: var(--panel-1);
    color: var(--text-bright);
    font-weight: var(--fw-semibold);
    box-shadow: var(--shadow-card);
}

/* ==========================================================
   表格 — iOS 风格：清爽 · 细线分隔 · 圆角容器
   ========================================================== */
.table-wrap { width: 100%; overflow: auto; }
.table-container {
    overflow: auto;
    max-height: calc(100vh - 260px);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-1);
}
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.data-table td {
    padding: 11px 16px;
    border-bottom: 0.5px solid var(--border-soft);
    color: var(--text-main);
}
.data-table tbody tr:hover td { background: rgba(var(--primary-rgb), 0.03); }
.data-table .text-center { text-align: center; }
.data-table .empty-tip { text-align: center; padding: 40px; color: var(--text-mute); }
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-size: var(--fs-base);
    color: var(--text-sub);
    border-top: 0.5px solid var(--border-soft);
}
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { opacity: 0.8; }
.sortable.sorted { color: var(--primary); }

/* ==========================================================
   侧边栏布局 — iOS 风格
   ========================================================== */
.layout-sidebar { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.sidebar {
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    min-height: 0;
    height: calc(100vh - 180px);
}
.sidebar-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--text-rgb), 0.2) transparent;
}
.sidebar-list::-webkit-scrollbar { width: 6px; -webkit-appearance: none; }
.sidebar-list::-webkit-scrollbar-track { background: transparent; }
.sidebar-list::-webkit-scrollbar-thumb { background: rgba(var(--text-rgb), 0.15); border-radius: 3px; }
.sidebar-list::-webkit-scrollbar-thumb:hover { background: rgba(var(--text-rgb), 0.3); }
.sidebar-item {
    padding: 11px 16px;
    border-radius: var(--radius-md);
    color: var(--text-sub);
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-item:hover { background: var(--surface-subtle); color: var(--text-main); }
.sidebar-item.active { background: rgba(var(--primary-rgb), 0.10); color: var(--primary); font-weight: var(--fw-semibold); }
.sidebar-count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-mute); background: var(--surface-soft); padding: 2px 8px; border-radius: 10px; }
.panel-split { display: flex; flex-direction: column; gap: 8px; height: calc(100vh - 180px); min-width: 0; }
.panel-split-top { flex-shrink: 0; }
.panel-split-bottom { flex: 1; min-height: 0; min-width: 0; }

/* ==========================================================
   月度选择器 — iOS 风格
   ========================================================== */
.month-pill, .pill-btn {
    padding: 9px 18px;
    border-radius: var(--radius-pill);
    border: 0.5px solid var(--border);
    background: var(--surface-subtle);
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.month-pill:hover, .pill-btn:hover { background: var(--surface-subtle-hover); color: var(--text-main); }
.month-pill.active, .pill-btn.active {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

/* ==========================================================
   Toast 通知 — iOS 风格：毛玻璃 · 圆润 · 轻滑入
   ========================================================== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    background: var(--bg-toast);
    border: 0.5px solid var(--border);
    box-shadow: var(--shadow-toast);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    min-width: 300px;
    max-width: 440px;
    animation: toastSlideIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.toast-icon { flex-shrink: 0; width: 22px; height: 22px; }
.toast-content { flex: 1; font-size: var(--fs-md); color: var(--text-main); font-weight: var(--fw-medium); }
.toast-close {
    background: var(--surface-subtle);
    border: none;
    color: var(--text-mute);
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-xl);
    transition: all 0.15s;
}
.toast-close:hover { background: var(--surface-subtle-hover); color: var(--text-main); }
.toast.removing { animation: toastSlideOut 0.25s ease-in forwards; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--orange); }

/* ==========================================================
   加载 & 空状态 — iOS 风格
   ========================================================== */
.loading-mask {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-loading);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.loading-mask.show { display: flex; }
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toastSlideIn { from { opacity: 0; transform: translateY(-8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastSlideOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

/* 表格 skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-subtle-hover) 50%, var(--surface-soft) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-row td { border: none; }

/* 表格 loading 态：显示 skeleton 并降低整体透明度 */
.skeleton {
    background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-subtle-hover) 50%, var(--surface-soft) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 6px;
}
@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton-table { width: 100%; border-collapse: collapse; }
.skeleton-table td { padding: 10px 12px; }
.skeleton-row { height: 18px; display: inline-block; width: 60%; }
.skeleton-row.short { width: 35%; }
.skeleton-row.long { width: 80%; }
.skeleton-actions { width: 60px; height: 18px; display: inline-block; }

/* ==========================================================
   表格操作下拉菜单 — iOS 风格
   ========================================================== */
.action-dropdown {
    position: relative;
    display: inline-block;
}
.action-dropdown-toggle {
    padding: 6px 12px;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-family: inherit;
    transition: all 0.2s;
}
.action-dropdown-toggle:hover { background: var(--surface-subtle-hover); color: var(--text-main); }
.action-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 130px;
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    z-index: 50;
    box-shadow: var(--shadow-dropdown);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.action-dropdown-menu.show { display: block; }
.action-dropdown-item {
    display: block;
    width: 100%;
    padding: 9px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-family: inherit;
    text-align: left;
    transition: all 0.15s;
}
.action-dropdown-item:hover { background: rgba(var(--primary-rgb), 0.08); color: var(--text-main); }
.action-dropdown-item.danger:hover { background: rgba(var(--color-error-rgb), 0.10); color: var(--color-error); }

/* 桌面端显示更多按钮，移动端显示下拉 */
@media (min-width: 768px) {
    .action-dropdown-toggle { display: none; }
    .action-dropdown-menu { display: flex; position: static; min-width: auto; background: transparent; border: none; padding: 0; box-shadow: none; gap: 6px; }
    .action-dropdown-item { width: auto; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; }
    .action-dropdown-item.danger { border-color: rgba(var(--color-error-rgb), 0.25); color: var(--color-error); }
}
@media (max-width: 767px) {
    .action-dropdown-menu { right: auto; left: 0; }
}

/* ==========================================================
   响应式断点
   ========================================================== */

/* ---- 平板 (768px - 1023px) ---- */
@media (max-width: 1023px) {
    .navbar { padding: 12px 16px; }
    .navbar-title { font-size: var(--fs-3xl); letter-spacing: var(--ls-wide); }
    .navbar-nav { gap: 4px; }
    .nav-link { padding: 7px 10px; font-size: var(--fs-sm); }
    .navbar-user { padding: 5px 10px; gap: 8px; }
    .user-name { font-size: var(--fs-sm); }
    .navbar-right { gap: 10px; }
    .navbar-right .btn-sm { padding: 5px 10px; font-size: var(--fs-sm); }

    .page-container { padding: 18px 22px; }
    /* 侧边栏在中小屏略收窄，把更多宽度让给内容区 */
    .pc-sidebar { width: 190px; min-width: 190px; }

    .table-container { max-height: calc(100vh - 240px); }
    .list-scroll { max-height: calc(100vh - 240px); }
    .panel-split { height: calc(100vh - 160px); gap: 8px; }

    .kpi-row { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .kpi-card { padding: 14px; }
    .kpi-value { font-size: var(--fs-2xl); }

    .card { padding: 16px; }
    .toolbar { gap: 8px; }
    .tab-btn { padding: 8px 18px; font-size: var(--fs-sm); }
    .dim-btn { padding: 7px 16px; font-size: var(--fs-sm); }

    .modal { width: 90vw; padding: 22px 24px; }
    .modal.modal-lg { width: 92vw; }
    .form-row { grid-template-columns: 1fr; }
}

/* ---- 平板/小桌面 (768px - 1023px)：导航折叠 ---- */
@media (max-width: 1023px) {
    .navbar-nav { display: none; }
    .navbar-user .user-name { display: none; }
}

/* ---- 手机 (< 768px) ---- */
@media (max-width: 767px) {
    /* 导航栏：底部导航已覆盖，隐藏桌面导航 */
    .navbar-nav { display: none; }
    .navbar { padding: 10px 10px; }
    .navbar-title { font-size: var(--fs-xl); letter-spacing: var(--ls-wide); }
    .navbar-right { gap: 8px; }
    /* 皮肤切换器：手机端保留（紧凑版，增大触控区域） */
    .theme-toggle-btn { padding: 8px 12px; font-size: var(--fs-sm); gap: 6px; min-height: 36px; }
    .theme-color-dot { width: 12px; height: 12px; }
    .navbar-user { padding: 4px 8px; }
    .navbar-user .user-name { display: none; }
    .navbar-right .btn-sm { padding: 5px 8px; font-size: var(--fs-sm); }
    /* 搜索按钮：增大触控目标 */
    .navbar-search-toggle { min-width: 36px; min-height: 36px; }
    .navbar-search { padding: 6px 8px; }
    .navbar-search input { font-size: var(--fs-md); padding: 6px 10px; }

    .page-container { padding: 10px 10px 24px; }

    .table-container { max-height: calc(100vh - 220px); }
    .table-pagination { padding: 8px 12px; font-size: var(--fs-sm); flex-wrap: wrap; gap: 6px; }
    .list-scroll { max-height: calc(100vh - 220px); }
    .panel-split { height: calc(100vh - 150px); gap: 8px; }

    /* KPI 卡片：2 列 */
    .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-card { padding: 12px; }
    .kpi-value { font-size: var(--fs-2xl); }
    .kpi-label { font-size: var(--fs-sm); margin-bottom: 6px; }
    .kpi-bottom { font-size: var(--fs-sm); margin-top: 6px; }

    /* 卡片 */
    .card { padding: 14px; border-radius: 10px; }
    .card-title { font-size: var(--fs-md); margin-bottom: 12px; }

    /* 工具栏：垂直堆叠 */
    .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .toolbar-left, .toolbar-right { flex-wrap: wrap; gap: 8px; }
    .toolbar-title { font-size: var(--fs-md); }

    /* 选项卡 / 维度切换：横向滚动 */
    .tab-bar, .dim-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { padding: 8px 16px; font-size: var(--fs-sm); white-space: nowrap; }
    .dim-btn { padding: 7px 14px; font-size: var(--fs-sm); white-space: nowrap; }

    /* 侧边栏布局：改为单列 */
    .layout-sidebar { grid-template-columns: 1fr; gap: 12px; }
    .sidebar {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 8px;
        gap: 4px;
        height: auto;
    }
    .sidebar > div:first-child { display: none; }
    .sidebar-search { flex-shrink: 0; }
    .sidebar-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        flex: 1;
        min-width: 0;
    }
    .sidebar-item {
        white-space: nowrap;
        padding: 8px 14px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    /* 表格：横向滚动 */
    .table-wrap { max-height: calc(100vh - 220px); }
    .data-table { font-size: var(--fs-sm); }
    .data-table th, .data-table td { padding: 8px 10px; }

    /* 弹窗：全宽 */
    .modal {
        width: 95vw;
        padding: 18px 16px;
        max-height: 92vh;
        border-radius: 10px;
    }
    .modal.modal-lg, .modal.modal-sm { width: 95vw; }
    .modal-title { font-size: var(--fs-xl); }
    .modal-header { margin-bottom: 16px; padding-bottom: 10px; }

    /* 表单：单列 */
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-input, .form-select, .form-textarea { font-size: var(--fs-sm); padding: 9px 12px; }

    /* 按钮 — 移动端触控目标 ≥ 44px (Apple HIG / Material Design) */
    .btn { padding: 10px 20px; font-size: var(--fs-sm); min-height: 44px; }
    .btn-sm { padding: 8px 14px; font-size: var(--fs-sm); min-height: 36px; }
    .navbar-right .btn-sm { min-height: 32px; }

    /* 表单输入 — 移动端触控目标 */
    .form-input, .form-select, .form-textarea { min-height: 44px; }

    /* 月度选择器药丸 — 触控目标 */
    .month-pill, .pill-btn { min-height: 36px; padding: 8px 14px; }

    /* Toast 位置调整 */
    .toast-container { top: 70px; right: 10px; left: 10px; }
    .toast { min-width: auto; }

    /* 显隐工具类反转 */
    .mobile-only { display: block !important; }
    .pc-only { display: none !important; }
}

/* hidden 类始终优先于 mobile-only / pc-only，确保 JS 控制的隐藏在所有屏幕尺寸生效 */
.hidden.mobile-only, .hidden.pc-only { display: none !important; }

/* ---- 窄屏弹窗/表单适配 (< 767px) ---- */
@media (max-width: 767px) {
    .modal-overlay .modal,
    .modal {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
    }
    .form-row {
        grid-template-columns: 1fr !important;
    }
    .modal-footer .btn,
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================
   全局无障碍 & 微交互增强
   ========================================================== */

/* 键盘焦点可见样式 */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

/* 弹窗入场动画 */
.modal-overlay.show .modal,
.modal-overlay[style*="display: flex"] .modal {
    animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 下拉菜单入场 */
.action-dropdown.open .action-dropdown-menu {
    animation: dropdownFadeIn 0.15s ease-out;
}
@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast 入场 */
.toast.show {
    animation: toastSlideIn 0.25s ease-out;
}
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================
   统一搜索框组件
   ========================================================== */
.search-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.search-box .icon {
    position: absolute;
    left: 10px;
    pointer-events: none;
    color: var(--text-mute);
}
.search-box input {
    padding-left: 32px;
    padding-right: 28px;
}
.search-box .search-clear {
    position: absolute;
    right: 6px;
    cursor: pointer;
    color: var(--text-mute);
    background: none;
    border: none;
    padding: 4px;
    display: none;
    font-size: var(--fs-md);
    line-height: var(--lh-tight);
}
.search-box .search-clear.visible { display: block; }

/* ==========================================================
   空状态组件 — iOS 风格
   ========================================================== */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-mute);
}
.empty-state .empty-icon {
    opacity: 0.25;
    margin-bottom: var(--space-4);
}
.empty-state .empty-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--text-sub);
    margin-bottom: var(--space-2);
}
.empty-state .empty-desc {
    font-size: var(--fs-sm);
    color: var(--text-mute);
    margin-bottom: var(--space-5);
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}
.empty-state .empty-action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* 空状态增强变体 */
.empty-state-vivid {
    padding: 52px 28px;
}
.empty-state-vivid .empty-icon-wrap {
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.08);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 20px; font-size: var(--fs-5xl); line-height: var(--lh-tight);
}
.empty-state-vivid .empty-title {
    font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--text-main);
    margin-bottom: 8px;
}
.empty-state-vivid .empty-desc {
    font-size: var(--fs-base); color: var(--text-sub); line-height: var(--lh-relaxed);
    margin-bottom: 24px; max-width: 300px;
    margin-left: auto; margin-right: auto;
}
.empty-state-features {
    display: flex; gap: 24px; justify-content: center; margin-bottom: 24px;
    flex-wrap: wrap;
}
.empty-state-feature {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: var(--fs-sm); color: var(--text-sub);
}
.empty-state-feature .feat-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: rgba(var(--primary-rgb), 0.06);
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-3xl);
}
.empty-state-cta {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px; font-size: var(--fs-md); font-weight: var(--fw-semibold);
    border-radius: 10px; border: none; cursor: pointer;
    background: var(--primary); color: var(--text-on-primary);
    transition: all 0.2s ease; text-decoration: none;
}
.empty-state-cta:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3); }
.empty-state-cta-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px; font-size: var(--fs-md); font-weight: var(--fw-semibold);
    border-radius: 10px; border: 1px solid var(--border); cursor: pointer;
    background: var(--surface-soft); color: var(--text-main);
    transition: all 0.2s ease; text-decoration: none;
}
.empty-state-cta-secondary:hover { border-color: var(--primary); color: var(--primary); }
.empty-state-actions {
    display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}

/* ---- 小屏手机 (< 380px) ---- */
@media (max-width: 380px) {
    .kpi-row { grid-template-columns: 1fr; }
    .navbar-title { font-size: var(--fs-md); }
    .navbar-right .btn-sm { padding: 4px 6px; font-size: var(--fs-2xs); }
}

/* ===== Alpine.js 组件样式 ===== */
.live-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
.live-dot-online { background: var(--green); box-shadow: 0 0 6px var(--green); animation:pulse-dot 2s infinite; }
.live-dot-offline { background: var(--text-mute); }
@keyframes pulse-dot { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
.alpine-table { width:100%; border-collapse:collapse; }
.alpine-table th { cursor:pointer; user-select:none; }
.alpine-table th:hover { opacity:0.7; }
[x-cloak] { display:none !important; }
.alpine-empty { text-align:center; padding:40px; color:var(--text-sub); }
.alpine-pagination { display:flex; gap:8px; align-items:center; justify-content:center; margin-top:12px; }

/* ===== 审计日志 diff 展示 ===== */
.audit-filters { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:16px; }
.audit-filters select,
.audit-filters input { padding:6px 12px; border:1px solid var(--border); border-radius:var(--radius-md, 6px); background:var(--bg-input); color:var(--text-main); font-size: var(--fs-sm); font-family:inherit; transition:all .2s; }
.audit-filters select:focus,
.audit-filters input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px rgba(var(--primary-rgb), 0.12); }
.audit-diff { margin:8px 0; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.diff-row { display:grid; grid-template-columns:1fr 2fr 40px 2fr; gap:8px; padding:6px 12px; font-size: var(--fs-sm); align-items:center; border-bottom:1px solid var(--border); }
.diff-row:last-child { border-bottom:none; }
.diff-field { font-weight: var(--fw-semibold); color:var(--text-sub); word-break:break-all; }
.diff-before { color:var(--text-main); word-break:break-all; }
.diff-after { color:var(--text-main); word-break:break-all; }
.diff-arrow { color:var(--text-sub); text-align:center; }
.diff-changed .diff-before { background: var(--color-warning-soft); text-decoration:line-through; opacity:0.7; }
.diff-changed .diff-after { background: rgba(var(--color-warning-rgb), 0.15); }
.diff-added .diff-after { background: var(--color-success-soft); color: var(--color-success); }
.diff-removed .diff-before { background: var(--color-error-soft); color: var(--color-error); text-decoration:line-through; opacity:0.7; }
.audit-detail-toggle { cursor:pointer; color:var(--primary); font-size: var(--fs-sm); user-select:none; }
.diff-toggle-icon { transition:transform 0.2s; display:inline-block; }
.diff-toggle-icon.open { transform:rotate(90deg); }

/* ---- 审计日志 diff 移动端单栏退化 ----
   注：.diff-row 基础定义位于本文件后段（源顺序晚于上方统一的 @media 767px 块），
   媒体查询规则不增加优先级，若写在上方块中会被后定义的基础规则按源顺序覆盖，
   因此此处单独追加同断点媒体查询，确保移动端 4 栏正确退化为单栏。 */
@media (max-width: 767px) {
    .diff-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 8px 12px;
        align-items: start;
    }
    .diff-arrow {
        transform: rotate(90deg);
    }
    .audit-filters {
        gap: 6px;
    }
}

/* ===== PWA 离线模式 ===== */
.offline-mode::after {
    content: '离线模式 - 数据可能不是最新';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-error);
    color: white;
    text-align: center;
    padding: 6px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    z-index: 10000;
}

/* PWA 安装浮动按钮悬停效果 */
#pwaInstallBtn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(var(--primary-rgb), 0.55);
}

/* ==========================================================
   浅色主题补充覆盖
   ========================================================== */
html[data-theme="light"] .kpi-card.highlight,
html[data-theme="champagne"] .kpi-card.highlight {
    background: linear-gradient(145deg, var(--color-error-soft), var(--panel-2));
}
html[data-theme="light"] .data-sidebar-item:hover,
html[data-theme="champagne"] .data-sidebar-item:hover {
    background: var(--surface-soft);
    color: var(--text-main);
}
html[data-theme="light"] .data-sidebar-item .count,
html[data-theme="champagne"] .data-sidebar-item .count {
    background: var(--surface-soft);
}
html[data-theme="light"] .source-group-header,
html[data-theme="champagne"] .source-group-header {
    background: var(--surface-source-header);
    border-color: var(--border-source-header);
}
html[data-theme="light"] .source-group-header:hover,
html[data-theme="champagne"] .source-group-header:hover {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.15);
}
html[data-theme="light"] .search-box input,
html[data-theme="champagne"] .search-box input {
    background: var(--bg-input);
    border-color: var(--border-input);
}
html[data-theme="light"] .search-box input:focus,
html[data-theme="champagne"] .search-box input:focus {
    background: var(--bg-input-focus);
}
html[data-theme="light"] .readonly-badge,
html[data-theme="champagne"] .readonly-badge {
    background: rgba(var(--text-mute-rgb), 0.14);
    border-color: rgba(var(--text-mute-rgb), 0.22);
}

/* ==========================================================
   通用工具类 / 统一组件补充
   ========================================================== */

/* 必填标记：统一使用语义化错误色 */
.required-mark,
.form-label .required,
.form-label .required-mark {
    color: var(--color-error);
    margin-left: 2px;
    font-weight: var(--fw-bold);
}

/* 系统管理页角色标签统一映射 */
.role-tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 12px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); border: 1px solid transparent; }
.role-tag.admin { background: var(--color-error-soft); border-color: rgba(var(--color-error-rgb), 0.3); color: var(--color-error); }
.role-tag.manager { background: var(--color-warning-soft); border-color: rgba(var(--color-warning-rgb), 0.3); color: var(--color-warning); }
.role-tag.user { background: var(--color-info-soft); border-color: rgba(var(--color-info-rgb), 0.3); color: var(--color-info); }
.role-tag.viewer { background: var(--surface-soft); border-color: var(--border-soft); color: var(--text-sub); }

/* 表格容器默认全宽 */
.table-wrap { width: 100%; }

/* 页面级布局兜底 */
.page-section { margin-bottom: var(--space-5); }

/* 辅助：文本截断 */
.text-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 弹窗遮罩可点击关闭区域（内部 modal 不触发） */
.modal-overlay { cursor: default; }
.modal-overlay .modal { cursor: default; }

/* ── 通知铃铛 — iOS 风格 ── */
.notif-bell-container {
    position: relative;
    display: flex;
    align-items: center;
}
.notif-bell-btn {
    background: var(--surface-subtle);
    border: 0.5px solid var(--border);
    cursor: pointer;
    padding: 8px;
    color: var(--text-sub);
    position: relative;
    border-radius: var(--radius-pill);
    transition: all 0.2s;
    display: flex;
    align-items: center;
}
.notif-bell-btn:hover {
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.10);
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: var(--red);
    color: var(--text-on-primary);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-semibold);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    transform: translate(25%, -25%);
    pointer-events: none;
}
.notif-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: calc(100vh - 80px);
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 200;
    display: none;
    flex-direction: column;
    overflow: hidden;
    margin-top: 8px;
}
.notif-dropdown.show {
    display: flex;
}
.notif-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 0.5px solid var(--border-soft);
    font-weight: var(--fw-bold);
    font-size: var(--fs-lg);
    color: var(--text-main);
    flex-shrink: 0;
    letter-spacing: var(--ls-wide);
}
.notif-mark-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.notif-mark-read:hover {
    background: rgba(var(--primary-rgb), 0.08);
}
.notif-dropdown-list {
    flex: 1;
    overflow-y: auto;
}
.notif-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-mute);
    font-size: var(--fs-base);
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 0.5px solid var(--border-soft);
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
}
.notif-item:hover {
    background: rgba(var(--primary-rgb), 0.03);
}
.notif-item.unread {
    background: rgba(var(--primary-rgb), 0.05);
}
.notif-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}
.notif-item-icon {
    font-size: var(--fs-xl);
    flex-shrink: 0;
    margin-top: 2px;
}
.notif-item-body {
    flex: 1;
    min-width: 0;
}
.notif-item-title {
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    color: var(--text-main);
    margin-bottom: 2px;
}
.notif-item-message {
    font-size: var(--fs-sm);
    color: var(--text-sub);
    line-height: var(--lh-body);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-item-time {
    font-size: var(--fs-xs);
    color: var(--text-mute);
    margin-top: 4px;
}
.notif-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.notif-permission-btn {
    width: 100%;
    padding: 8px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 8px;
    color: var(--primary);
    font-size: var(--fs-base);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.notif-permission-btn:hover {
    background: rgba(var(--primary-rgb), 0.2);
}

@media (max-width: 767px) {
    .notif-dropdown {
        position: fixed;
        top: 56px;
        right: 10px;
        left: auto;
        width: min(320px, calc(100vw - 20px));
        max-height: calc(100vh - 80px);
        margin-top: 0;
    }
}

/* ── 骨架屏增强样式 ── */
.skeleton-kpi {
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 80px;
}
.skeleton-title {
    height: 14px;
    width: 60%;
    border-radius: 4px;
}
.skeleton-value {
    height: 24px;
    width: 40%;
    border-radius: 4px;
    margin-top: 4px;
}
.skeleton-chart {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    margin-top: 8px;
}
.skeleton-card {
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    min-height: 200px;
}
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.skeleton-row {
    height: 48px;
    border-radius: 6px;
    width: 100%;
}
.skeleton-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: var(--panel-1);
    border-radius: inherit;
}

/* ── 用户引导样式 ── */
.onboarding-step {
    font-size: var(--fs-xs);
    color: var(--text-mute);
    margin-bottom: 8px;
    font-weight: var(--fw-medium);
}
.onboarding-title {
    font-size: var(--fs-2xl);
    font-weight: var(--fw-bold);
    color: var(--text-bright);
    margin: 0 0 8px;
}
.onboarding-content {
    font-size: var(--fs-md);
    color: var(--text-sub);
    line-height: var(--lh-relaxed);
    margin: 0 0 16px;
}
.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.onboarding-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
    font-family: inherit;
    transition: all 0.2s;
}
.onboarding-btn.skip {
    background: transparent;
    color: var(--text-mute);
}
.onboarding-btn.skip:hover {
    color: var(--text-sub);
}
.onboarding-btn.next {
    background: var(--primary);
    color: var(--text-on-primary);
}
.onboarding-btn.next:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ==========================================================
   表格头 — iOS 风格
   ========================================================== */
.data-table th {
    text-align: left;
    padding: 11px 16px;
    color: var(--text-sub);
    font-weight: var(--fw-semibold);
    font-size: var(--fs-sm);
    letter-spacing: var(--ls-wide);
    background: var(--bg-table-head);
    border-bottom: 0.5px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ==========================================================
   香槟金主题专属增强
   ========================================================== */
html[data-theme="champagne"] .card,
html[data-theme="champagne"] .kpi-card {
    background: linear-gradient(145deg, var(--bg-card), var(--panel-2));
}
html[data-theme="champagne"] .navbar {
    border-bottom-color: rgba(var(--primary-rgb), 0.15);
}
html[data-theme="champagne"] .navbar-title {
    text-shadow: 0 1px 2px rgba(var(--primary-rgb), 0.1);
}
html[data-theme="champagne"] .btn-primary:hover {
    box-shadow: 0 2px 12px rgba(var(--primary-rgb), 0.35);
}
html[data-theme="champagne"] .kpi-card::before {
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb), 0.4), transparent);
}
html[data-theme="champagne"] .data-table th {
    border-bottom-color: rgba(var(--primary-rgb), 0.2);
}
html[data-theme="champagne"] .sidebar-item.active {
    background: rgba(var(--primary-rgb), 0.1);
}
html[data-theme="champagne"] .modal {
    border-color: rgba(var(--primary-rgb), 0.12);
}
html[data-theme="champagne"] ::selection {
    background: rgba(var(--primary-rgb), 0.2);
}

/* ==========================================================
   晨曦白主题专属增强
   ========================================================== */
html[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 2px 12px rgba(var(--primary-rgb), 0.3);
}
html[data-theme="light"] ::selection {
    background: rgba(var(--primary-rgb), 0.15);
}

/* ==========================================================
   全局选区与滚动条美化
   ========================================================== */
::selection {
    background: rgba(var(--primary-rgb), 0.15);
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-input); border-radius: 4px; }

/* ==========================================================
   SVG 图标系统
   ========================================================== */
.pangu-icon {
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; vertical-align: middle;
}
.pangu-icon svg { width: 100%; height: 100%; }

/* 分类瓷片中的图标 */
.qa-cat-chip .pangu-icon { width: 28px; height: 28px; margin-bottom: 2px; transition: all 0.2s; }
.qa-cat-chip.active .pangu-icon { color: var(--primary); }
.speed-cat-chip .pangu-icon { width: 28px; height: 28px; margin-bottom: 2px; transition: all 0.2s; }
.speed-cat-chip.active .pangu-icon { color: var(--primary); }

/* 流水列表中的图标 */
.tx-icon .pangu-icon { width: 24px; height: 24px; }

/* FAB 按钮中的图标 */
.speed-fab .pangu-icon { width: 28px; height: 28px; }

/* ==========================================================
   数字键盘 (POS 风格)
   ========================================================== */
.nk-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: transparent; visibility: hidden;
    transition: background 0.25s, visibility 0.25s;
    display: flex; align-items: flex-end; justify-content: center;
}
.nk-overlay.show {
    background: var(--bg-overlay); visibility: visible;
}
.nk-sheet {
    width: 100%; max-width: 480px;
    background: var(--panel-1);
    border-radius: 20px 20px 0 0;
    padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--shadow-dropdown);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh; overflow-y: auto;
}
.nk-overlay.show .nk-sheet { transform: translateY(0); }
.nk-sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.nk-sheet-title {
    font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-main);
}
.nk-sheet-close {
    width: 32px; height: 32px; border: none; border-radius: 50%;
    background: var(--surface-soft); color: var(--text-sub);
    font-size: var(--fs-3xl); cursor: pointer; line-height: var(--lh-tight);
    display: flex; align-items: center; justify-content: center;
}
.nk-sheet-close:active { background: rgba(var(--primary-rgb), 0.1); }
.nk-display-area {
    text-align: center; padding: 4px 0 2px;
    min-height: 40px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
}
.nk-display-expr {
    font-size: var(--fs-sm); color: var(--text-sub);
    font-family: var(--font-mono); line-height: var(--lh-heading);
    min-height: 14px;
}
.nk-display-main { display: flex; align-items: baseline; justify-content: center; }
.nk-display {
    font-size: var(--fs-5xl); font-weight: var(--fw-bold); font-family: var(--font-mono);
    color: var(--text-mute); letter-spacing: var(--ls-tight); line-height: var(--lh-tight);
    font-variant-numeric: var(--num-tnum); font-feature-settings: var(--num-features);
}
.nk-display.has-value { color: var(--text-main); }

.num-keyboard {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 6px; padding: 8px 0 4px; max-width: 400px; margin: 0 auto;
    user-select: none; -webkit-user-select: none;
}
.num-keyboard .nk-btn {
    height: 46px; border: 0.5px solid var(--border);
    border-radius: var(--radius-md); background: var(--panel-1);
    color: var(--text-main); font-size: var(--fs-3xl); font-weight: var(--fw-medium);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.1s; font-family: var(--font-mono);
    -webkit-tap-highlight-color: transparent;
}
.num-keyboard .nk-btn:active {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: var(--primary);
    transform: scale(0.95);
}
.num-keyboard .nk-btn.nk-func {
    font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--text-sub);
    background: var(--surface-soft);
}
.num-keyboard .nk-btn.nk-func:active {
    background: rgba(var(--primary-rgb), 0.06);
}
.num-keyboard .nk-btn.nk-backspace {
    font-size: var(--fs-xl);
}
.num-keyboard .nk-btn.nk-op {
    font-size: var(--fs-3xl); font-weight: var(--fw-semibold); color: var(--text-sub);
    background: var(--surface-soft);
}
.num-keyboard .nk-btn.nk-op.active {
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
    border-color: var(--primary);
}
.num-keyboard .nk-btn.nk-date {
    font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-sub);
    background: var(--surface-soft); line-height: var(--lh-heading);
}
.num-keyboard .nk-btn.nk-date.changed {
    color: var(--primary); border-color: var(--primary);
}
.num-keyboard .nk-btn.nk-submit {
    background: var(--primary); color: var(--text-on-primary);
    font-size: var(--fs-lg); font-weight: var(--fw-semibold); border-color: var(--primary);
}
.num-keyboard .nk-btn.nk-submit:active {
    opacity: 0.85; transform: scale(0.95);
}
.num-keyboard .nk-btn.nk-submit:disabled {
    opacity: 0.4; cursor: not-allowed;
}

/* ── 日期选择模态弹窗 ── */
.nk-date-modal {
    position: fixed; inset: 0; z-index: 9100;
    background: transparent; visibility: hidden;
    transition: background 0.25s, visibility 0.25s;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.nk-date-modal.show {
    background: var(--bg-overlay); visibility: visible;
}
.nk-date-modal-dialog {
    width: 100%; max-width: 340px;
    background: var(--panel-1);
    border-radius: 16px; overflow: hidden;
    box-shadow: var(--shadow-modal);
    transform: scale(0.9); opacity: 0;
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s;
}
.nk-date-modal.show .nk-date-modal-dialog {
    transform: scale(1); opacity: 1;
}
.nk-date-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 8px;
}
.nk-date-modal-title {
    font-size: var(--fs-xl); font-weight: var(--fw-semibold); color: var(--text-main);
}
.nk-date-modal-close {
    width: 28px; height: 28px; border: none; border-radius: 50%;
    background: var(--surface-soft); color: var(--text-sub);
    font-size: var(--fs-3xl); cursor: pointer; line-height: var(--lh-tight);
    display: flex; align-items: center; justify-content: center;
}
.nk-date-modal-close:active { background: rgba(var(--primary-rgb), 0.1); }
.nk-date-modal-body { padding: 0 16px 8px; }
.nk-date-picker-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.nk-date-nav {
    width: 32px; height: 32px; border: none; border-radius: var(--radius-sm);
    background: var(--surface-soft); color: var(--text-sub);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.nk-date-nav:active { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.nk-date-picker-title {
    font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-main);
}
.nk-date-picker-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    margin-bottom: 4px;
}
.nk-date-picker-weekdays span {
    text-align: center; font-size: var(--fs-sm); font-weight: var(--fw-semibold);
    color: var(--text-mute); padding: 4px 0;
}
.nk-date-picker-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.nk-date-cell {
    aspect-ratio: 1; border: 1px solid transparent; border-radius: 6px;
    background: var(--surface-soft); color: var(--text-sub);
    font-size: var(--fs-md); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.12s; font-family: var(--font-mono);
    -webkit-tap-highlight-color: transparent;
}
.nk-date-cell:active { transform: scale(0.92); }
.nk-date-cell.empty { background: transparent; cursor: default; pointer-events: none; }
.nk-date-cell.today {
    border-color: var(--primary); color: var(--primary); font-weight: var(--fw-bold);
}
.nk-date-cell.selected {
    background: var(--primary); color: var(--text-on-primary); font-weight: var(--fw-bold);
    border-color: var(--primary);
}
.nk-date-cell.selected.today {
    background: var(--primary); color: var(--text-on-primary);
}
.nk-date-today-btn {
    width: calc(100% - 32px); margin: 8px 16px 16px; padding: 10px;
    border: none; border-radius: var(--radius-md);
    background: rgba(var(--primary-rgb), 0.1); color: var(--primary);
    font-size: var(--fs-md); font-weight: var(--fw-semibold); cursor: pointer;
    transition: all 0.15s;
}
.nk-date-today-btn:active { background: rgba(var(--primary-rgb), 0.18); }

/* 金额显示区 */
.num-amount-display {
    text-align: center; padding: 16px 0 8px;
}
.num-amount-display .num-amount-value {
    font-size: var(--fs-6xl); font-weight: var(--fw-bold); font-family: var(--font-mono);
    color: var(--text-main); letter-spacing: var(--ls-tight); line-height: var(--lh-heading);
    font-variant-numeric: var(--num-tnum); font-feature-settings: var(--num-features);
    min-height: 50px; word-break: break-all;
}
.num-amount-display .num-amount-value.placeholder {
    color: var(--text-mute); font-weight: var(--fw-normal); font-size: var(--fs-5xl);
}
.num-amount-display .num-amount-cursor {
    display: inline-block; width: 2px; height: 36px;
    background: var(--primary); margin-left: 2px; vertical-align: middle;
    animation: cursorBlink 1s step-end infinite;
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ── 流动画 ── */
@keyframes txItemIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.tx-item { animation: txItemIn 0.25s ease both; }
.tx-item:nth-child(1) { animation-delay: 0s; }
.tx-item:nth-child(2) { animation-delay: 0.03s; }
.tx-item:nth-child(3) { animation-delay: 0.06s; }
.tx-item:nth-child(4) { animation-delay: 0.09s; }
.tx-item:nth-child(5) { animation-delay: 0.12s; }
.tx-item:nth-child(6) { animation-delay: 0.15s; }
.tx-item:nth-child(7) { animation-delay: 0.18s; }
.tx-item:nth-child(8) { animation-delay: 0.21s; }
.tx-item:nth-child(9) { animation-delay: 0.24s; }
.tx-item:nth-child(10) { animation-delay: 0.27s; }

/* 分类瓷片选中动画 */
@keyframes chipSelect {
    0% { transform: scale(1); }
    50% { transform: scale(0.92); }
    100% { transform: scale(1); }
}
.qa-cat-chip.just-selected { animation: chipSelect 0.2s ease; }

/* 分类管理入口瓷片 */
.qa-cat-mgr { border-style: dashed; opacity: 0.7; }
.qa-cat-mgr:hover { opacity: 1; }
.qa-cat-mgr .pangu-icon { color: var(--text-mute); }
.qa-cat-mgr:hover .pangu-icon { color: var(--primary); }

/* ── 记账成功提示动画 ── */
@keyframes saveSuccess {
    0% { opacity: 0; transform: translateY(20px) scale(0.8); }
    50% { transform: translateY(-5px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.save-success-toast {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 999; animation: saveSuccess 0.4s ease;
    background: var(--primary); color: var(--text-on-primary);
    padding: 16px 28px; border-radius: var(--radius-lg);
    font-size: var(--fs-xl); font-weight: var(--fw-semibold); box-shadow: var(--shadow-modal);
    pointer-events: none;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ==========================================================
   页面/区块标题统一类（P1: 统一排版层次）
   ========================================================== */
.page-title {
    font-size: var(--fs-3xl);
    font-weight: var(--fw-bold);
    color: var(--text-bright);
    line-height: var(--lh-heading);
    letter-spacing: var(--ls-tight);
}
.section-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--text-main);
    line-height: var(--lh-heading);
    letter-spacing: var(--ls-normal);
}
.card-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text-main);
    line-height: var(--lh-heading);
    letter-spacing: var(--ls-normal);
}
.card-title-sm {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-mute);
    line-height: var(--lh-body);
    letter-spacing: var(--ls-wide);
}

/* ==========================================================
   三级卡片层级体系（P1: 视觉层次拉开）
   ========================================================== */
.card-l1 {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    border: 0.5px solid var(--border);
    padding: var(--space-4);
}
.card-l2 {
    background: var(--surface-soft);
    border-radius: var(--radius-lg);
    box-shadow: none;
    border: 0.5px solid var(--border-soft);
    padding: var(--space-4);
}
.card-l3 {
    background: var(--surface-subtle);
    border-radius: var(--radius-md);
    box-shadow: none;
    border: none;
    padding: var(--space-2) var(--space-4);
}

/* ==========================================================
   金额色彩语义工具类（可选使用）
   ========================================================== */
.amount-income { color: var(--amount-income); }
.amount-expense { color: var(--amount-expense); }
.amount-neutral { color: var(--text-bright); }

/* ==========================================================
   按压动效（P2: iOS 风格触觉反馈）
   ========================================================== */
.btn-press {
    transition: transform 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn-press:active {
    transform: scale(0.96);
    opacity: 0.88;
}
.card-press {
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.card-press:active {
    transform: scale(0.98);
}

/* ==========================================================
   Skeleton 骨架屏增强（P2: shimmer 动画统一）
   ========================================================== */
.skeleton-kpi,
.skeleton-title,
.skeleton-value,
.skeleton-chart,
.skeleton-card,
.skeleton-list,
.skeleton-row,
.skeleton-wrapper {
    background: linear-gradient(90deg, var(--surface-soft) 25%, var(--surface-subtle-hover) 50%, var(--surface-soft) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================
   全局触控优化 — 移动端体验增强
   ========================================================== */
@media (max-width: 767px) {
    /* 移除移动端 hover 效果（避免点击后残留） */
    .growth-kpi-card:hover,
    .growth-card:hover,
    .gx-item:hover,
    .repay-item:hover,
    .qa-cat-chip:hover,
    .tx-item:hover,
    .habit-item:hover,
    .stat-card:hover,
    .me-tool-item:hover,
    .me-settings-row:hover {
        transform: none;
        box-shadow: none;
    }

    /* 移动端触控激活态（按压反馈） */
    .growth-kpi-card:active,
    .growth-card:active,
    .gx-item:active,
    .repay-item:active,
    .qa-cat-chip:active,
    .tx-item:active,
    .habit-item:active,
    .stat-card:active,
    .me-tool-item:active,
    .me-settings-row:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ==========================================================
   全局滚动条美化
   ========================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(var(--text-mute-rgb), 0.2);
    border-radius: 3px;
    transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--text-mute-rgb), 0.35);
}

/* ==========================================================
   页面过渡动画
   ========================================================== */
.page-fade-enter {
    opacity: 0;
    transform: translateY(6px);
}
.page-fade-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ==========================================================
   全局番茄钟浮动卡片
   ========================================================== */
.pomodoro-floating {
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--panel-1), var(--panel-2));
    border: 0.5px solid var(--border);
    box-shadow: var(--shadow-card), 0 8px 32px rgba(var(--primary-rgb), 0.18);
    z-index: 96;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 0.25s ease, opacity 0.25s ease;
    transform: translate3d(var(--float-x, 0), var(--float-y, 0), 0);
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}
.pomodoro-floating.active {
    display: flex;
    animation: floatPopIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.pomodoro-floating:hover {
    box-shadow: var(--shadow-card-hover), 0 12px 40px rgba(var(--primary-rgb), 0.22);
}
.pomodoro-floating.dragging {
    cursor: grabbing;
    transition: none;
    animation: none;
}
@keyframes floatPopIn {
    from { opacity: 0; transform: scale(0.6) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.float-timer-ring-wrap {
    position: relative;
    width: 100%;
    height: 100%;
}
.float-timer-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.float-timer-ring-bg {
    fill: none;
    stroke: var(--surface-soft);
    stroke-width: 4;
}
.float-timer-ring-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s linear;
}
.float-timer-ring-progress.break { stroke: var(--green); }
.float-timer-ring-progress.long-break { stroke: var(--secondary); }

.float-timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    pointer-events: none;
}
.float-timer-time {
    font-size: 17px;
    font-weight: var(--fw-semibold);
    color: var(--text-main);
    font-variant-numeric: var(--num-tnum);
    line-height: 1.1;
    letter-spacing: var(--ls-tight);
}
.float-timer-label {
    font-size: 9px;
    color: var(--text-mute);
    font-weight: var(--fw-medium);
    margin-top: 2px;
    letter-spacing: var(--ls-wide);
}
.float-timer-label.focus { color: var(--primary); }
.float-timer-label.break { color: var(--green); }
.float-timer-label.long-break { color: var(--secondary); }

.float-timer-controls {
    position: absolute;
    right: -10px;
    bottom: -10px;
    display: flex;
    gap: 6px;
}
.float-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--panel-1);
    border: 0.5px solid var(--border);
    box-shadow: var(--shadow-small);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.float-btn:hover {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
    transform: scale(1.08);
}
.float-btn:active {
    transform: scale(0.94);
}

/* 移动端：放左下角，避免与右下角记账 FAB 重叠 */
@media (max-width: 767px) {
    .pomodoro-floating {
        right: auto;
        left: 16px;
        bottom: 84px;
        width: 88px;
        height: 88px;
        padding: 9px;
    }
    .float-timer-time { font-size: 15px; }
    .float-timer-label { font-size: 8px; }
    .float-btn {
        width: 28px;
        height: 28px;
    }
}

/* ==========================================================
   通用卡片基底（APP 化 S1：响应式底座统一）
   说明：所有卡片类共用此基底，避免各模板重复 inline 定义；
        各模板 .xxx-card 仅保留差异（如 ::before 装饰条、transition）。
        走主题 CSS 变量，双主题自动适配。
   ========================================================== */
.pangu-card,
.debt-card {
    padding: 20px 22px;
    border-radius: var(--radius-xl);
    background: var(--panel-1);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    box-sizing: border-box;
    min-width: 0;
    position: relative;
    width: 100%;
}

/* ── 通用表格横向滚动容器（S2 引入，供 debt/data 等表格复用） ── */
.table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* 表格响应式滚动容器（Bootstrap 语义一致）：data 等页用 .table-responsive 包裹
   <table>，此前 main.css 未定义该类的 overflow，导致窄屏表格撑破整页；
   加 overflow-x:auto 后表格在容器内横向滚动，配合 .data-table{min-width} 列不被压垮。 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}