/**
 * 财务模块共享样式库 - Finance Common CSS v9.0
 * 统一设计系统：SVG图标 + 一致导航 + 专业排版
 *
 * v9.0 变更：
 *   - 统一导航栏组件（带SVG图标）
 *   - 移除所有emoji图标，改用SVG inline
 *   - IBM Plex Sans 字体（专业金融风格）
 *   - 统一页面头部样式
 *   - 优化统计卡片视觉层次
 */

/* ============================================
   全局移动端防护 — 禁止任何横向滚动
   ============================================ */
html, body { overflow-x: hidden; max-width: 100vw; }
*, *::before, *::after { box-sizing: border-box; }

/* 统一移动端断点：768px(平板/大手机) / 480px(小手机) */
@media (max-width: 768px) {
  /* 所有 grid 容器强制最多 2 列 */
  .stats-grid, .stats-row, .summary-cards, .overview-grid, .overview-row, .stat-grid, .card-grid, .kanban-grid,
  [class*="stats"][class*="grid"], [class*="stats"][class*="row"],
  [class*="overview"][class*="grid"], [class*="overview"][class*="row"],
  [class*="summary"][class*="card"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  /* flex 工具栏强制换行 */
  .toolbar, .filter-bar, .filter-row, .filter-toolbar, .date-filter-bar, .filter-mode-group,
  [class*="filter"][class*="bar"], [class*="filter"][class*="row"], [class*="filter"][class*="toolbar"] {
    flex-direction: column !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .toolbar > *, .filter-bar > *, .filter-row > *, .filter-toolbar > *, .date-filter-bar > *, .filter-mode-group > *,
  [class*="filter"][class*="bar"] > *, [class*="filter"][class*="row"] > *, [class*="filter"][class*="toolbar"] > * {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* 表格容器允许纵向滚动但不横向溢出 */
  .table-wrapper, .table-container, [class*="table"][class*="wrap"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
  }
  /* 看板列改为纵向堆叠 */
  .kanban { flex-direction: column !important; overflow-x: hidden !important; }
  .kanban-col { min-width: 100% !important; max-height: none !important; margin-bottom: 12px; }
  /* 模态框全宽 */
  .modal, [class*="modal"][class*="content"] { width: 95vw !important; max-width: 95vw !important; left: 2.5vw !important; }
  /* 统计卡片缩小 */
  .stat-card, .summary-card, .overview-card { padding: 10px 12px !important; gap: 8px !important; }
  .stat-value, .summary-value, .overview-value { font-size: 18px !important; }
  .stat-label, .summary-label, .overview-label { font-size: 11px !important; }
}

@media (max-width: 480px) {
  /* 小屏幕卡片保持 2 列 */
  .stats-grid, .stats-row, .summary-cards, .overview-grid, .overview-row, .stat-grid, .card-grid,
  [class*="stats"][class*="grid"], [class*="stats"][class*="row"],
  [class*="overview"][class*="grid"], [class*="overview"][class*="row"],
  [class*="summary"][class*="card"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .page, [class*="page"][class*="content"] { padding: 10px !important; }
  h1 { font-size: 16px !important; }
  .stat-card, .summary-card, .overview-card { padding: 8px 10px !important; }
}

/* ============================================
   字体导入
   ============================================ */
@import url('https://fonts.googleapis.cn/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&display=swap');

/* ============================================
   CSS 变量定义
   ============================================ */
:root {
    /* 主色调 */
    --primary: #0083FF;
    --primary-light: #2299FF;
    --primary-dark: #0068D7;
    --primary-50: #F0F7FF;
    --primary-100: #DBEAFE;
    --accent: #66B8FF;
    --accent-light: #B3D9FF;
    --primary-bg: #F8FAFF;

    /* 功能色 */
    --success: #22C55E;
    --success-light: #DCFCE7;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    /* 中性色 */
    --text-primary: #1E293B;
    --text-regular: #475569;
    --text-secondary: #94A3B8;
    --text-muted: #CBD5E1;
    --text-white: #FFFFFF;

    /* 边框/背景 */
    --border-dark: #CBD5E1;
    --border-regular: #E2E8F0;
    --border-light: #F1F5F9;
    --bg-page: #F8FAFC;
    --bg-container: #FFFFFF;
    --bg-subtle: #F1F5F9;
    --bg-hover: #F0F7FF;

    /* 圆角 */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* 阴影 */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 8px 10px rgba(0,0,0,0.04);

    /* 导航栏 */
    --nav-height: 56px;
    --nav-height-admin: 72px;
    --nav-bg: #1E6FD9;

    /* 字体 */
    --font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   全局基础样式
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-family);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   SVG 图标系统
   ============================================ */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* ============================================
   统一导航栏
   ============================================ */
.finance-nav {
    background: var(--nav-bg);
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(30, 111, 217, 0.3);
}
.finance-nav-inner {
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 4px;
    max-width: 1600px;
    margin: 0 auto;
}
.finance-nav-brand {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin-right: 28px;
    text-decoration: none;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.finance-nav-brand svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
    stroke-width: 2;
}
.finance-nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}
.finance-nav-link {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}
.finance-nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.15);
}
.finance-nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.22);
    font-weight: 600;
}
.finance-nav-back {
    margin-left: 8px;
    color: rgba(255,255,255,0.4) !important;
    border-left: 1px solid rgba(255,255,255,0.1);
    padding-left: 16px !important;
}
.finance-nav-back:hover {
    color: rgba(255,255,255,0.8) !important;
}
.finance-nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 16px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 500;
}
.finance-nav-user svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    opacity: 0.7;
}
.finance-nav-user .nav-logout {
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.finance-nav-user .nav-logout:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.08);
}
.finance-nav-user .nav-user-dropdown-wrap {
    position: relative;
}
.finance-nav-user .nav-user-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.finance-nav-user .nav-user-trigger:hover {
    background: rgba(255,255,255,0.08);
}
.finance-nav-user .nav-user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 140px;
    z-index: 1000;
    overflow: hidden;
    display: none;
}
.finance-nav-user .nav-user-dropdown.nav-user-dd-open {
    display: block;
}
.finance-nav-user .nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
    cursor: pointer;
}
.finance-nav-user .nav-dropdown-item:hover {
    background: #f5f5f5;
}
.finance-nav-user .nav-dropdown-item svg {
    width: 15px;
    height: 15px;
    stroke: #666;
    fill: none;
    stroke-width: 2;
}
.nav-role-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    white-space: nowrap;
}
.nav-role-badge.admin {
    background: rgba(255,180,50,0.3);
    color: #ffd580;
}
.nav-role-badge.group-admin {
    background: rgba(100,200,255,0.2);
    color: #80d4ff;
}

/* ==================== 通知按钮 ==================== */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
}
.nav-hamburger:hover {
    background: rgba(255,255,255,0.15);
}

.nav-notification-btn {
    position: relative;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
}
.nav-notification-btn:hover {
    background: rgba(255,255,255,0.1);
}
.nav-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #ef4444;
    border-radius: 8px;
    padding: 0 4px;
}

/* ==================== 通知下拉面板 ==================== */
.nav-notification-dropdown {
    position: fixed;
    top: 56px;
    right: 16px;
    width: 360px;
    max-height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 10000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body.is-admin .nav-notification-dropdown {
    top: 72px;
}
.nav-notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    font-size: 14px;
}
.nav-notif-header a {
    font-size: 12px;
    color: var(--primary, #4f46e5);
    text-decoration: none;
    cursor: pointer;
}
.nav-notif-header a:hover { text-decoration: underline; }
.nav-notif-list {
    overflow-y: auto;
    max-height: 420px;
}
.nav-notif-empty {
    padding: 40px 16px;
    text-align: center;
    color: #999;
    font-size: 13px;
}
.nav-notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.1s;
}
.nav-notif-item:hover { background: #f9fafb; }
.nav-notif-item.unread { background: #eff6ff; }
.nav-notif-item.unread:hover { background: #dbeafe; }
.nav-notif-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 8px;
}
.nav-notif-body {
    flex: 1;
    min-width: 0;
}
.nav-notif-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}
.nav-notif-content {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.nav-notif-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Admin-only nav items - body.is-admin 由 finance-nav.js 动态添加 */
body:not(.is-admin) .admin-only-link { display: none !important; }

/* 管理员导航 - 双行布局，确保所有菜单可见 */
.finance-nav-links.admin-nav {
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
    max-height: 48px;
    overflow: hidden;
    line-height: 1;
    align-content: flex-start;
    padding-top: 1px;
}
.finance-nav-links.admin-nav .finance-nav-link {
    padding: 4px 9px;
    font-size: 12.5px;
    flex-shrink: 0;
    line-height: 1.6;
}

/* ============================================
   统一页面头部
   ============================================ */
.finance-page-header {
    padding: 28px 32px 20px;
}
.finance-page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.finance-page-header h1 .header-icon {
    width: 28px;
    height: 28px;
    color: var(--primary);
}
.finance-page-header h1 .header-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.finance-page-header .page-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    margin-left: 38px;
}

/* ============================================
   统计卡片网格
   ============================================ */
.finance-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 0 32px 20px;
}
.finance-stat-card {
    background: var(--bg-container);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.finance-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}
.finance-stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.finance-stat-card:hover::before {
    opacity: 1;
}
.finance-stat-card.success::before { background: var(--success); opacity: 1; }
.finance-stat-card.warning::before { background: var(--warning); opacity: 1; }
.finance-stat-card.danger::before { background: var(--danger); opacity: 1; }
.finance-stat-card.info::before { background: var(--info); opacity: 1; }

.finance-stat-card .stat-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.finance-stat-card .stat-icon-wrap svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.finance-stat-card .stat-icon-wrap.blue {
    background: var(--primary-50);
    color: var(--primary);
}
.finance-stat-card .stat-icon-wrap.green {
    background: var(--success-light);
    color: var(--success);
}
.finance-stat-card .stat-icon-wrap.amber {
    background: var(--warning-light);
    color: var(--warning);
}
.finance-stat-card .stat-icon-wrap.red {
    background: var(--danger-light);
    color: var(--danger);
}
.finance-stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}
.finance-stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.finance-stat-card .stat-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   内容区域
   ============================================ */
.finance-content {
    padding: 0 32px 32px;
}

/* ============================================
   渐变光带纹理 - 用于顶栏/侧边栏/Hero (保留兼容)
   ============================================ */
.gradient-texture {
    background: linear-gradient(135deg, #0083FF 0%, #0083FF 100%);
    position: relative;
    overflow: hidden;
}
.gradient-texture::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 40%,
        rgba(102,184,255,0.15) 45%,
        rgba(102,184,255,0.3) 50%,
        rgba(102,184,255,0.15) 55%,
        transparent 60%,
        transparent 100%
    );
    pointer-events: none;
}
.gradient-texture::after {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 180%;
    height: 180%;
    background: linear-gradient(
        120deg,
        transparent 20%,
        rgba(255,255,255,0.08) 35%,
        rgba(255,255,255,0.15) 40%,
        rgba(255,255,255,0.08) 45%,
        transparent 55%
    );
    pointer-events: none;
}

/* ============================================
   基础组件
   ============================================ */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.5;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
}
.btn-primary:active {
    background: var(--primary-dark);
}
.btn-primary:disabled {
    background: #66B5FF;
    cursor: not-allowed;
    opacity: 0.7;
}
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary-50);
}
.btn-ghost {
    background: transparent;
    color: var(--text-regular);
}
.btn-ghost:hover {
    background: var(--bg-subtle);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #DC2626;
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #16A34A;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}
.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* 卡片 */
.card {
    background: var(--bg-container);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body {
    padding: 20px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: var(--bg-subtle);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light);
}
.data-table td {
    padding: 12px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}
.data-table tr:hover td {
    background: var(--bg-hover);
}

/* 标签/徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-default { background: var(--bg-subtle); color: var(--text-secondary); }

/* Toast 通知 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 14px;
    font-family: var(--font-family);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.modal-box {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-subtle);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    transition: all 0.15s;
}
.modal-close:hover {
    background: var(--border-regular);
    color: var(--text-primary);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 表单 */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-regular);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,131,255,0.1);
}
.form-input::placeholder {
    color: var(--text-muted);
}
.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(2px);
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.empty-state .empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-muted);
}
.empty-state .empty-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.pagination button {
    min-width: 32px;
    height: 32px;
    border: 1px solid var(--border-regular);
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-family);
    color: var(--text-regular);
    transition: all 0.15s;
}
.pagination button:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   筛选栏
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 3px;
}
.filter-tab {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all 0.15s;
    font-family: var(--font-family);
}
.filter-tab:hover {
    color: var(--text-primary);
}
.filter-tab.active {
    background: #fff;
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

/* ============================================
   响应式
   ============================================ */
/* 平板端导航栏切换为汉堡菜单 */
@media (max-width: 1024px) {
    .finance-nav-inner { gap: 0; height: 48px !important; padding: 0 12px; position: relative; }
    .finance-nav-brand { margin-right: auto; font-size: 13px; }
    .finance-nav-brand svg { width: 16px; height: 16px; }
    .nav-hamburger { display: flex; flex-shrink: 0; }
    .finance-nav-user {
        margin-left: 4px; gap: 6px; flex-shrink: 0;
    }
    .finance-nav-user .nav-user-name { display: none; }
    .finance-nav-user .nav-role-badge { font-size: 9px; padding: 1px 4px; }
    .finance-nav-user .nav-logout { font-size: 11px; padding: 3px 8px; }
    .finance-nav-links {
        display: none; position: fixed; top: 48px; left: 0; right: 0; bottom: 0;
        background: #1E293B; flex-direction: column; padding: 8px 12px 24px;
        gap: 2px; z-index: 999; overflow-y: auto; -webkit-overflow-scrolling: touch;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    .finance-nav-links.nav-links-open { display: flex; }
    /* ===== 移动端管理员菜单完整展开（覆盖桌面双行 max-height:48px 限制）===== */
    .finance-nav-links.admin-nav {
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        flex-wrap: nowrap !important;
        align-content: stretch !important;
    }
    .finance-nav-link {
        padding: 12px 14px; font-size: 14px; width: 100%; border-radius: 6px;
    }
}

@media (max-width: 768px) {
    /* 全局禁止横向滚动 */
    html, body { overflow-x: hidden; max-width: 100vw; }
    * { -webkit-tap-highlight-color: transparent; }
    .finance-nav { padding: 0; }
    
    .finance-page-header { padding: 16px 12px 12px; }
    .finance-page-header h1 { font-size: 18px; }
    .finance-stats-grid { padding: 0 12px 12px; grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
    .finance-content { padding: 0 12px 12px; }
    .finance-stat-card { padding: 12px; }
    .finance-stat-card .stat-value { font-size: 16px; }
    
    /* 通用统计卡片网格 - 覆盖各种命名 */
    .stats-grid, .stats-row, .stat-row, .stat-grid, .summary-cards, .overview-grid, .overview-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* 页面容器统一缩窄 padding */
    .page-container, .max-w-7xl, .max-w-5xl, .max-w-4xl { padding: 12px !important; }
    .finance-page-header { padding-left: 12px; padding-right: 12px; }
    
    /* 筛选栏纵向堆叠 */
    .filter-bar, .date-filter-bar, .toolbar, .toolbar-left {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .filter-bar > *, .date-filter-bar > *, .toolbar > *, .toolbar-left > * {
        width: 100% !important;
        max-width: 100% !important;
    }
    .filter-mode-group, .filter-tabs {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    /* 表单行纵向 */
    .form-row { flex-direction: column !important; gap: 8px !important; }
    .form-row > * { width: 100% !important; }
    
    /* 模态框适配 */
    .modal, .modal-content, .modal-box {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 10px auto !important;
    }
    
    /* 通知下拉 */
    .nav-notification-dropdown { width: calc(100vw - 24px) !important; right: -8px !important; max-height: 400px; }
}

@media (max-width: 480px) {
    .finance-nav-brand { font-size: 12px; }
    .finance-nav-brand svg { display: none; }
    .finance-page-header h1 { font-size: 16px; }
    .finance-page-header .page-header-actions { flex-wrap: wrap; gap: 6px; }
    .finance-page-header .page-header-actions button,
    .finance-page-header .page-header-actions .btn {
        padding: 6px 12px; font-size: 12px;
    }
    .finance-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .finance-stat-card .stat-value { font-size: 18px; }
    
    /* 通用统计卡片 - 移动端始终2列 */
    .stats-grid, .stats-row, .stat-row, .stat-grid,
    .summary-cards, .overview-grid, .overview-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    
    /* Card content tighter */
    .expense-card-header, .loan-card-header { padding: 10px 12px; }
    .expense-card-header .card-title, .loan-card-header .card-title { font-size: 14px; }
    
    /* Filter bar wraps */
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .filter-controls { flex-wrap: wrap; gap: 6px; }
    .filter-bar select, .filter-bar input { font-size: 13px; max-width: 100%; }
    
    /* Charts stack */
    #chartsRow { grid-template-columns: 1fr !important; }
    
    /* Modal full width */
    .modal-content { width: 95% !important; margin: 10px auto; }
    .modal-header h3 { font-size: 16px; }
    .modal-body { padding: 12px; }
    .modal-footer { flex-wrap: wrap; }
    
    /* Table horizontal scroll - 表格允许横滚但卡片不允许 */
    .table-container, .data-table-wrap, .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
    
    /* Form inputs full width */
    .form-group input, .form-group select, .form-group textarea { width: 100%; }
    .form-row { flex-direction: column; gap: 8px; }
    
    /* Toast full width */
    #toast-container, .toast-container { left: 8px !important; right: 8px !important; min-width: auto !important; }
    
    /* Calendar cells smaller */
    .calendar-cell { min-height: 48px; padding: 2px; }
    .calendar-event { font-size: 9px; padding: 1px 3px; }
}

/* 价格列隐藏 - 普通用户不可见 */
.hide-price .price-col {
    display: none !important;
}
