/* 企业财务系统 - 全局样式 */
:root {
    --primary: #1677ff;
    --sidebar-bg: #001529;
    --sidebar-width: 220px;
    --header-height: 56px;
    --mobile-header-height: 56px;
    --mobile-tabbar-height: 56px;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #f5f5f5;
    position: relative;
}

#app {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    position: relative;
}

/* 防止横向溢出 */
img {
    max-width: 100%;
    height: auto;
}

/* 防止文本溢出 */
.text-overflow {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ===================== 通用组件 ===================== */
.page-title { font-size: 18px; font-weight: 600; margin: 0 0 16px; }
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.page-sub { color: #999; font-size: 13px; }
.card-shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-card { text-align: center; padding: 20px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin: 8px 0; }
.stat-card .label { color: #999; font-size: 13px; }
.money-debit { color: #ff4d4f; }
.money-credit { color: #52c41a; }
.text-muted { color: #999; }
.mb-16 { margin-bottom: 16px; }

/* 搜索栏 */
.search-bar { margin-bottom: 16px; }
.search-bar .ant-form-item { margin-bottom: 8px; }

/* ===================== 登录页 ===================== */
.login-bg {
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}
.login-bg::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}
.login-card {
    background: #fff; border-radius: 12px; padding: 40px;
    width: 400px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-header { text-align: center; margin-bottom: 24px; }
.login-title { font-size: 24px; font-weight: 700; color: #1a1a2e; margin: 0 0 8px; }
.login-subtitle { color: #999; font-size: 13px; margin: 0; }

/* ===================== 主布局（PC端） ===================== */
.main-layout { 
    display: flex; 
    height: 100vh; 
    height: 100dvh;
    position: relative;
    overflow: hidden;
}
.sidebar {
    width: var(--sidebar-width); background: var(--sidebar-bg);
    overflow-y: auto; flex-shrink: 0; display: flex; flex-direction: column;
    transition: transform 0.3s ease;
    /* 防止 transform 影响 fixed 子元素 */
    transform: none !important;
    will-change: auto !important;
}
.sidebar-brand {
    padding: 16px 20px; color: #fff; font-size: 16px; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 8px;
}
.sidebar-brand .logo { font-size: 22px; }
.sidebar-menu { flex: 1; padding: 8px 0; }
.sidebar-menu .menu-group-title {
    padding: 12px 20px 4px; font-size: 11px; color: rgba(255,255,255,0.35);
    text-transform: uppercase; letter-spacing: 1px;
}
.sidebar-menu .menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: rgba(255,255,255,0.65); cursor: pointer;
    transition: all 0.2s; font-size: 14px; text-decoration: none;
}
.sidebar-menu .menu-item:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-menu .menu-item.active { color: #fff; background: var(--primary); }
.sidebar-menu .menu-item .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-menu .menu-item .sub-arrow { margin-left: auto; font-size: 10px; }
.sidebar-menu .submenu-items .menu-item { padding-left: 48px; font-size: 13px; }

.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    min-width: 0;
    /* 关键：确保不创建新的层叠上下文，让 fixed 子元素可以正确定位 */
    transform: none !important;
    will-change: auto !important;
}
.top-header {
    height: var(--header-height); background: #fff; border-bottom: 1px solid #f0f0f0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; flex-shrink: 0;
}
.top-header .breadcrumb-area { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-header .user-area { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.content-body { 
    flex: 1; 
    overflow-y: auto; 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 20px 24px; 
    background: #f5f5f5;
    min-height: 0;
    /* 防止横向溢出 */
    max-width: 100%;
    width: 100%;
}

/* ===================== 移动端抽屉 ===================== */
.mobile-drawer-mask {
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: rgba(0,0,0,0.5); 
    z-index: 1000;
    opacity: 0; 
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}
.mobile-drawer-mask.show { 
    opacity: 1; 
    visibility: visible; 
}

/* ===================== 移动端底部导航 ===================== */
.mobile-tabbar {
    position: fixed !important; 
    bottom: 0 !important; 
    left: 0 !important; 
    right: 0 !important;
    height: var(--mobile-tabbar-height);
    background: #fff; 
    border-top: 1px solid #f0f0f0;
    display: flex !important; 
    z-index: 9999 !important;
    padding-bottom: env(safe-area-inset-bottom);
    /* 确保不受父元素影响 */
    transform: none !important;
    will-change: auto !important;
    /* 阴影效果 */
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    /* 防止被遮挡 */
    pointer-events: auto;
}
.mobile-tabbar-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #999; cursor: pointer;
    font-size: 11px; gap: 2px;
    padding: 4px 0;
    transition: color 0.2s;
    min-height: 44px;
}
.mobile-tabbar-item .tab-icon { font-size: 20px; }
.mobile-tabbar-item.active { color: var(--primary); }
.mobile-tabbar-item .tab-label { font-size: 11px; }

/* ===================== 移动端更多菜单面板 ===================== */
.mobile-more-panel {
    position: fixed;
    bottom: var(--mobile-tabbar-height);
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    border-radius: 16px 16px 0 0;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 101;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.mobile-more-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f5f5f5;
    font-weight: 600;
    font-size: 15px;
}
.mobile-more-close {
    cursor: pointer;
    padding: 4px 8px;
    color: #999;
    font-size: 18px;
}
.mobile-more-close:active {
    color: #666;
}
.mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
.mobile-more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.mobile-more-item:active {
    background: #f5f5f5;
}
.mobile-more-item.active {
    background: #e6f4ff;
}
.mobile-more-item .more-icon {
    font-size: 24px;
    margin-bottom: 6px;
}
.mobile-more-item .more-label {
    font-size: 12px;
    color: #666;
    text-align: center;
}
.mobile-more-item.active .more-label {
    color: var(--primary);
    font-weight: 500;
}

@media (max-width: 480px) {
    .mobile-more-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===================== 移动端表格卡片化 ===================== */
.mobile-card-list .mobile-card {
    background: #fff; border-radius: 8px;
    padding: 12px 16px; margin-bottom: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.mobile-card .mobile-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.mobile-card .mobile-card-title {
    font-weight: 600; font-size: 14px; color: #1a1a1a;
}
.mobile-card .mobile-card-row {
    display: flex; justify-content: space-between;
    font-size: 13px; color: #666;
    padding: 3px 0;
}
.mobile-card .mobile-card-row .label { color: #999; flex-shrink: 0; }
.mobile-card .mobile-card-row .value { text-align: right; }
.mobile-card .mobile-card-actions {
    display: flex; gap: 8px; margin-top: 10px;
    padding-top: 10px; border-top: 1px solid #f5f5f5;
}

.mobile-page-header .mobile-header-actions {
    display: flex; flex-direction: column; gap: 8px; margin-top: 12px;
}
.mobile-page-header .mobile-header-actions .ant-btn {
    height: 44px; font-size: 16px;
}

/* 移动端表单卡片内边距优化 */
.invoice-form-page .ant-card-body {
    padding: 12px;
}
.invoice-form-page .ant-form-item {
    margin-bottom: 14px;
}
.invoice-form-page .ant-divider {
    margin: 12px 0;
}

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

/* 平板 */
@media (max-width: 1024px) {
    .content-body { padding: 16px; }
    .top-header { padding: 0 16px; }
    .top-header .breadcrumb-area .ant-select { max-width: 180px; }
}

/* 手机横屏/大屏手机 */
@media (max-width: 768px) {
    :root {
        --header-height: var(--mobile-header-height);
    }

    /* 隐藏PC端侧边栏，使用移动端抽屉 */
    .main-layout .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 260px !important;
        max-width: 80vw;
        z-index: 1001; 
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0,0,0,0.15);
        transition: transform 0.3s ease;
        visibility: visible;
    }
    .main-layout .sidebar.show { 
        transform: translateX(0); 
        box-shadow: 4px 0 16px rgba(0,0,0,0.2);
    }

    .main-layout {
        flex-direction: column;
    }

    .main-content { 
        width: 100% !important;
        flex: 1;
        margin-left: 0 !important;
    }

    /* 顶部导航适配 */
    .top-header {
        padding: 0 12px;
        position: sticky; top: 0; z-index: 50;
    }
    .top-header .breadcrumb-area { gap: 8px; }
    .top-header .breadcrumb-area .ant-select { width: 140px !important; max-width: 140px; }
    .top-header .user-area .ant-avatar { width: 32px; height: 32px; font-size: 14px; }
    .top-header .user-area .username-text { display: none; }

    /* 内容区适配 - 预留底部TabBar空间 */
    .content-body {
        padding: 12px;
        padding-bottom: calc(var(--mobile-tabbar-height) + 16px + env(safe-area-inset-bottom, 0px));
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }

    /* 页面头部 */
    .page-header {
        flex-direction: column; align-items: stretch;
        gap: 8px;
    }
    .page-header > * { width: 100%; }
    .page-header .ant-space { flex-wrap: wrap; }
    .page-header .ant-space > * { flex: 1; }

    /* 卡片适配 */
    .ant-card { margin-bottom: 12px; }
    .ant-card-head { padding: 0 12px; min-height: 44px; }
    .ant-card-head-title { font-size: 15px; }
    .ant-card-body { padding: 12px; }

    /* 表单适配 */
    .ant-form-item { margin-bottom: 12px; }
    .ant-form-item-label { padding-bottom: 4px; }
    .ant-form-item-control { min-height: 40px; }

    /* 内联表单改为垂直 */
    .search-bar.ant-form-layout-inline {
        display: flex; flex-direction: column;
    }
    .search-bar.ant-form-layout-inline .ant-form-item {
        display: block; margin-right: 0; width: 100%;
    }
    .search-bar .ant-form-item-label {
        float: none; width: auto; margin-right: 8px;
        display: inline-block;
    }
    .search-bar .ant-form-item-control {
        display: inline-block; width: calc(100% - 60px);
    }
    .search-bar .ant-input,
    .search-bar .ant-select,
    .search-bar .ant-picker {
        width: 100% !important; max-width: 100%;
    }

    /* 按钮适配 */
    .ant-btn { padding: 0 16px; height: 40px; font-size: 14px; }
    .ant-btn-lg { height: 44px; font-size: 15px; }
    .ant-btn-sm { height: 32px; font-size: 13px; }

    /* 表格适配 */
    .ant-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .ant-table { font-size: 13px; }
    .ant-table-thead > tr > th { padding: 8px 6px; font-size: 12px; }
    .ant-table-tbody > tr > td { padding: 8px 6px; }

    /* 统计卡片适配 */
    .stat-card { padding: 12px; }
    .stat-card .value { font-size: 20px; margin: 4px 0; }
    .stat-card .label { font-size: 12px; }

    /* Row/Col适配 */
    .ant-row { margin-left: 0 !important; margin-right: 0 !important; }
    .ant-row > [class*="ant-col-"] {
        padding-left: 8px !important; padding-right: 8px !important;
    }
    .ant-row .ant-col-6,
    .ant-row .ant-col-8,
    .ant-row .ant-col-12,
    .ant-row .ant-col-24 {
        flex: 0 0 100%; max-width: 100%;
    }

    /* Modal适配 - 移动端居中 */
    .ant-modal {
        max-width: calc(100vw - 24px);
        width: calc(100vw - 24px) !important;
        margin: 0 auto !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        padding-bottom: 0;
    }
    .ant-modal-content { border-radius: 12px; max-height: calc(100vh - 32px); overflow: hidden; display: flex; flex-direction: column; }
    .ant-modal-body { padding: 16px; overflow-y: auto; flex: 1; }
    .ant-modal-header { padding: 16px 16px 8px; }
    .ant-modal-footer { padding: 12px 16px; border-top: 1px solid #f0f0f0; }

    /* Descriptions适配 */
    .ant-descriptions-item-label,
    .ant-descriptions-item-content {
        padding: 8px 12px !important;
    }

    /* Tabs适配 */
    .ant-tabs-nav { font-size: 14px; }
    .ant-tabs-tab { padding: 8px 12px; }

    /* Alert适配 */
    .ant-alert { padding: 8px 12px; }

    /* Tag适配 */
    .ant-tag { font-size: 12px; padding: 1px 6px; }

    /* Message适配 - 居中显示 */
    .ant-message {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: auto;
        max-width: calc(100vw - 32px);
        pointer-events: none;
    }
    .ant-message .ant-message-notice-wrapper {
        pointer-events: auto;
        margin-bottom: 8px;
    }
    .ant-message-notice-content {
        display: inline-flex;
        align-items: center;
        padding: 8px 16px;
        border-radius: 8px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
        font-size: 14px;
        max-width: calc(100vw - 48px);
        word-break: break-word;
    }

    /* 登录页适配 */
    .login-card { padding: 28px 20px; border-radius: 16px; }
    .login-title { font-size: 20px; }

    /* Drawer适配 */
    .ant-drawer-content-wrapper { width: 85% !important; max-width: 320px; }
}

/* 手机 */
@media (max-width: 480px) {
    .page-header h2 { font-size: 16px; }
    .content-body { padding: 10px; }
    .ant-card-head { padding: 0 10px; min-height: 40px; }
    .ant-card-body { padding: 10px; }

    /* 统计网格自适应 */
    .mobile-stat-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 大按钮适配 */
    .ant-btn-lg { height: 42px; }

    /* 表格更紧凑 */
    .ant-table-thead > tr > th { padding: 6px 4px; font-size: 11px; }
    .ant-table-tbody > tr > td { padding: 6px 4px; font-size: 12px; }

    /* 图标尺寸 */
    .mobile-card .tab-icon { font-size: 18px; }
}

/* ===================== 动画效果 ===================== */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.25s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

/* ===================== 触摸优化 ===================== */
@media (hover: none) {
    .sidebar-menu .menu-item:hover {
        background: transparent !important;
    }
    .sidebar-menu .menu-item:active {
        background: rgba(255,255,255,0.1) !important;
    }
    .mobile-tabbar-item:active {
        background: #f5f5f5;
    }
    .mobile-card:active {
        transform: scale(0.98);
    }
}

/* ===================== 滚动条美化 ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bfbfbf; }
::-webkit-scrollbar-track { background: transparent; }

/* 移动端隐藏滚动条 */
@media (max-width: 768px) {
    .ant-table-wrapper::-webkit-scrollbar { display: none; }
    .content-body::-webkit-scrollbar { width: 4px; }
}

/* ===================== 安全区域 ===================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-tabbar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .content-body {
        padding-bottom: calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom) + 12px);
    }
}

/* ===================== 打印样式 ===================== */
@media print {
    .sidebar, .mobile-tabbar, .mobile-drawer-mask, .mobile-drawer { display: none !important; }
    .main-layout { display: block; height: auto; }
    .content-body { padding: 0; }
    .top-header { border: none; }
}

/* ===================== 深色模式支持 ===================== */
@media (prefers-color-scheme: dark) {
    body { background: #141414; }
    .top-header { background: #1f1f1f; border-color: #303030; }
    .content-body { background: #0a0a0a; }
    .mobile-tabbar { background: #1f1f1f; border-color: #303030; }
    .mobile-tabbar-item { color: #8c8c8c; }
    .mobile-card { background: #1f1f1f; }
}

/* 禁用深色模式（保持品牌一致性） */
@media (prefers-color-scheme: dark) {
    body { background: #f5f5f5; color: inherit; }
    .top-header { background: #fff; border-color: #f0f0f0; }
    .content-body { background: #f5f5f5; }
    .mobile-tabbar { background: #fff; border-color: #f0f0f0; }
    .mobile-card { background: #fff; }
}

/* ===================== 移动端表单优化 ===================== */
@media (max-width: 768px) {
    /* 表单项垂直布局优化 */
    .ant-form-item-label {
        float: none !important;
        width: 100% !important;
        text-align: left !important;
        padding-bottom: 4px !important;
    }
    .ant-form-item-control {
        width: 100% !important;
    }
    .ant-form-item-control-input {
        min-height: 40px;
    }
    
    /* 输入框和选择器触摸优化 */
    .ant-input, .ant-input-affix-wrapper, .ant-select-selector,
    .ant-picker, .ant-input-number {
        min-height: 40px;
        font-size: 15px;
    }
    .ant-input-affix-wrapper .ant-input {
        min-height: 38px;
    }
    
    /* 按钮触摸区域优化 */
    .ant-btn {
        min-height: 40px;
        padding: 0 16px;
        font-size: 15px;
    }
    .ant-btn-block {
        width: 100%;
    }
    
    /* 表单区域分组 */
    .form-section {
        margin-bottom: 16px;
        padding: 12px;
        background: #fafafa;
        border-radius: 8px;
    }
    .form-section-title {
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 12px;
        color: #1a1a1a;
    }
    
    /* 抽屉宽度优化 - 居中显示 */
    .ant-drawer-content-wrapper {
        width: 90% !important;
        max-width: 360px;
        margin: 0 auto;
    }
    .ant-drawer {
        /* 移动端抽屉改为居中弹窗样式 */
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        height: auto !important;
        max-height: calc(100vh - 32px);
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    }
    
    /* Modal 优化 - 居中显示 */
    .ant-modal {
        width: calc(100vw - 32px) !important;
        max-width: 480px;
        margin: 0 auto !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    .ant-modal-body {
        max-height: calc(100vh - 180px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Notification 居中 */
    .ant-notification {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        right: auto !important;
        max-width: calc(100vw - 32px);
        width: auto;
    }
    
    /* Segmented 控件优化 */
    .ant-segmented {
        width: 100%;
    }
    .ant-segmented-item {
        min-height: 40px;
        padding: 0 12px;
    }
    
    /* 凭证分录表格移动端优化 */
    .entry-table-mobile {
        display: block;
    }
    .entry-table-mobile .entry-card {
        background: #fff;
        border: 1px solid #f0f0f0;
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 8px;
    }
    .entry-table-mobile .entry-row {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        font-size: 13px;
    }
    .entry-table-mobile .entry-row .label {
        color: #999;
    }
    .entry-table-mobile .entry-total {
        font-weight: 600;
        border-top: 1px solid #f0f0f0;
        padding-top: 8px;
        margin-top: 8px;
    }
    
    /* Tabs 优化 */
    .ant-tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ant-tabs-nav::-webkit-scrollbar {
        display: none;
    }
    .ant-tabs-tab {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Steps 优化 */
    .ant-steps-horizontal {
        overflow-x: auto;
        min-width: max-content;
        padding-bottom: 8px;
    }
    
    /* Tag 触摸区域优化 */
    .ant-tag {
        padding: 4px 10px;
        font-size: 13px;
    }
    
    /* Switch 优化 */
    .ant-switch {
        min-width: 44px;
    }
    
    /* Radio/Checkbox 触摸区域优化 */
    .ant-radio-wrapper, .ant-checkbox-wrapper {
        min-height: 40px;
        padding: 8px 0;
    }
    
    /* Table 在移动端的优化 */
    .ant-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ant-table {
        min-width: 600px;
    }
    
    /* Statistic 统计数字优化 */
    .ant-statistic-title {
        font-size: 12px;
    }
    .ant-statistic-content {
        font-size: 20px;
    }
    
    /* Descriptions 列表优化 */
    .ant-descriptions-item-label,
    .ant-descriptions-item-content {
        padding: 8px 12px !important;
    }
    
    /* Timeline 优化 */
    .ant-timeline-item-content {
        margin-inline-start: 12px;
    }
    
    /* Progress 优化 */
    .ant-progress {
        margin: 8px 0;
    }
    
    /* Upload 组件优化 */
    .ant-upload.ant-upload-select {
        width: 100%;
    }
    .ant-upload-drag {
        padding: 16px;
    }
    
    /* Avatar 优化 */
    .ant-avatar {
        font-size: 14px;
    }
    
    /* Breadcrumb 优化 */
    .ant-breadcrumb {
        font-size: 13px;
    }
    
    /* Pagination 优化 */
    .ant-pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .ant-pagination-item {
        min-width: 36px;
        height: 36px;
        line-height: 34px;
    }
    .ant-pagination-prev,
    .ant-pagination-next {
        min-width: 36px;
        height: 36px;
    }
    
    /* Tooltip 优化 */
    .ant-tooltip {
        font-size: 13px;
        max-width: calc(100vw - 32px);
    }
    
    /* Select/Dropdown/Picker 下拉菜单居中 */
    .ant-select-dropdown,
    .ant-dropdown-menu,
    .ant-picker-panel-container,
    .ant-cascader-menus,
    .ant-tree-select-dropdown {
        max-width: calc(100vw - 32px);
        overflow-x: auto;
    }
    
    /* Popover 居中 */
    .ant-popover {
        max-width: calc(100vw - 32px);
    }
    
    /* Message 优化 - 与前面的居中样式保持一致 */
    .ant-message-notice-content {
        max-width: calc(100vw - 48px);
        min-width: auto;
        word-break: break-word;
    }
    
    /* Spin 加载居中 */
    .ant-spin-nested-loading,
    .ant-spin-container {
        min-height: 100px;
    }
    
    /* Empty 组件居中 */
    .ant-empty {
        padding: 24px 0;
    }
}

/* ===================== 移动端卡片详情页样式 ===================== */
@media (max-width: 768px) {
    .detail-card {
        background: #fff;
        border-radius: 8px;
        padding: 16px;
        margin-bottom: 12px;
    }
    .detail-card-title {
        font-weight: 600;
        font-size: 15px;
        margin-bottom: 12px;
        color: #1a1a1a;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .detail-row {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid #f5f5f5;
        font-size: 14px;
    }
    .detail-row:last-child {
        border-bottom: none;
    }
    .detail-row .label {
        color: #999;
        flex-shrink: 0;
        margin-right: 12px;
    }
    .detail-row .value {
        color: #1a1a1a;
        text-align: right;
        word-break: break-all;
    }
    .detail-amount {
        font-size: 20px;
        font-weight: 600;
        color: #1677ff;
    }
    .detail-amount-negative {
        color: #ff4d4f;
    }
    
    /* 图片预览优化 */
    .detail-image {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }
    
    /* 附件列表优化 */
    .attachment-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    .attachment-item {
        display: flex;
        align-items: center;
        padding: 8px 12px;
        background: #f5f5f5;
        border-radius: 6px;
        font-size: 13px;
    }
}

/* ===================== 移动端加载动画 ===================== */
@media (max-width: 768px) {
    .mobile-loading {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 40px 0;
    }
    .mobile-loading-spinner {
        width: 32px;
        height: 32px;
        border: 3px solid #f0f0f0;
        border-top-color: #1677ff;
        border-radius: 50%;
        animation: mobile-spin 0.8s linear infinite;
    }
    @keyframes mobile-spin {
        to { transform: rotate(360deg); }
    }
    
    /* 骨架屏优化 */
    .ant-skeleton {
        padding: 12px;
    }
}

/* ===================== 移动端底部安全区域 ===================== */
@supports (padding: max(0px)) {
    .mobile-tabbar {
        padding-bottom: max(env(safe-area-inset-bottom), 0px);
    }
    .content-body {
        padding-bottom: calc(var(--mobile-tabbar-height) + max(env(safe-area-inset-bottom), 0px) + 12px);
    }
}

/* ===================== 移动端性能优化 ===================== */
@media (max-width: 768px) {
    /* 减少动画时间，提升流畅度 */
    .ant-card, .ant-btn, .ant-input, .ant-select {
        transition-duration: 0.15s;
    }
    
    /* 图片懒加载占位 */
    img {
        background: #f5f5f5;
    }
    
    /* 禁用不必要的阴影效果 */
    .ant-card, .mobile-card {
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    }
    
    /* 优化重绘性能 */
    .content-body, .ant-modal-body, .ant-drawer-body {
        will-change: transform;
    }
}

/* ===================== 移动端横屏优化 ===================== */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-tabbar {
        height: 44px;
    }
    .content-body {
        padding-bottom: 56px;
    }
    .top-header {
        height: 44px;
    }
    .content-body {
        padding-top: 44px;
    }
}

/* ===================== 移动端可访问性 ===================== */
@media (max-width: 768px) {
    /* 增大点击区域 */
    .ant-btn, .ant-radio, .ant-checkbox, .ant-switch {
        min-height: 40px;
    }
    
    /* 焦点状态可见性 */
    .ant-btn:focus-visible,
    .ant-input:focus-visible,
    .ant-select:focus-visible {
        outline: 2px solid #1677ff;
        outline-offset: 2px;
    }
    
    /* 禁用文字选择的交互元素 */
    .ant-btn, .mobile-tabbar-item, .mobile-card {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* ===================== 移动端数据展示优化 ===================== */
@media (max-width: 768px) {
    /* 数字金额等宽字体 */
    .amount-text, .money-text, .number-text {
        font-variant-numeric: tabular-nums;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    }
    
    /* 百分比显示优化 */
    .percent-positive { color: #52c41a; }
    .percent-negative { color: #ff4d4f; }
    
    /* 表格固定列优化 */
    .ant-table-cell-fix-left,
    .ant-table-cell-fix-right {
        position: sticky !important;
        z-index: 1;
    }
}

/* ===================== 移动端特定组件样式 ===================== */
@media (max-width: 768px) {
    /* 会计科目树形视图 */
    .subject-tree-mobile .subject-node {
        padding: 10px 12px;
        border-bottom: 1px solid #f5f5f5;
    }
    .subject-tree-mobile .subject-children {
        padding-left: 16px;
    }
    
    /* 凭证编辑器 */
    .voucher-editor-mobile .entry-row {
        display: flex;
        gap: 8px;
        margin-bottom: 8px;
    }
    .voucher-editor-mobile .entry-row .ant-form-item {
        margin-bottom: 0;
    }
    
    /* 报表视图 */
    .report-mobile-section {
        margin-bottom: 16px;
    }
    .report-mobile-title {
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 8px;
        padding: 8px 12px;
        background: #f5f5f5;
        border-radius: 6px;
    }
    
    /* AI 助手对话 */
    .ai-chat-mobile .ai-message {
        padding: 10px 14px;
        border-radius: 12px;
        margin-bottom: 10px;
        max-width: 85%;
    }
    .ai-chat-mobile .ai-message-user {
        background: #1677ff;
        color: #fff;
        margin-left: auto;
    }
    .ai-chat-mobile .ai-message-assistant {
        background: #f5f5f5;
        color: #1a1a1a;
    }
}

/* ===================== 移动端组件居中修复（全局） ===================== */
@media (max-width: 768px) {
    /* Ant Design Vue 组件全局居中修复 */
    
    /* Message 提示 - 屏幕正中显示 */
    .ant-message {
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px;
        width: auto !important;
        max-width: calc(100vw - 32px) !important;
        z-index: 2000;
        pointer-events: none;
    }
    .ant-message .ant-message-notice-wrapper {
        pointer-events: auto;
        display: block;
    }
    .ant-message-notice-content {
        display: flex !important;
        align-items: center !important;
        padding: 10px 16px !important;
        border-radius: 10px !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
        font-size: 14px !important;
        line-height: 1.5 !important;
        max-width: calc(100vw - 48px) !important;
        word-break: break-word !important;
        white-space: normal !important;
    }
    .ant-message-success .anticon,
    .ant-message-error .anticon,
    .ant-message-warning .anticon,
    .ant-message-info .anticon {
        font-size: 18px !important;
        margin-right: 8px !important;
    }
    
    /* Modal 弹窗 - 居中显示 */
    .ant-modal-wrap {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 16px !important;
    }
    .ant-modal {
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        margin: 0 !important;
        top: auto !important;
        transform: none !important;
        position: relative !important;
        top: 0 !important;
    }
    .ant-modal-content {
        border-radius: 12px !important;
        max-height: calc(100vh - 32px) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .ant-modal-body {
        max-height: calc(100vh - 200px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Drawer 抽屉 - 居中弹窗样式 */
    .ant-drawer-content-wrapper {
        width: calc(100vw - 32px) !important;
        max-width: 360px !important;
        margin: 0 auto !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        height: auto !important;
        max-height: calc(100vh - 32px) !important;
    }
    .ant-drawer {
        position: relative !important;
        height: auto !important;
        max-height: calc(100vh - 32px) !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.2) !important;
    }
    
    /* Notification 通知 - 居中显示 */
    .ant-notification {
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        max-width: calc(100vw - 32px) !important;
        width: calc(100vw - 32px) !important;
    }
    
    /* Select/Dropdown/Picker 下拉菜单 - 防止溢出 */
    .ant-select-dropdown,
    .ant-dropdown-menu,
    .ant-picker-panel-container,
    .ant-cascader-menus,
    .ant-tree-select-dropdown,
    .ant-auto-complete-dropdown {
        max-width: calc(100vw - 16px) !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
    }
    
    /* Popover 气泡卡片 - 防止溢出 */
    .ant-popover {
        max-width: calc(100vw - 16px) !important;
    }
    .ant-popover-inner {
        max-width: calc(100vw - 16px) !important;
    }
    
    /* Tooltip 文字提示 - 防止溢出 */
    .ant-tooltip {
        max-width: calc(100vw - 16px) !important;
    }
    .ant-tooltip-inner {
        max-width: calc(100vw - 32px) !important;
        word-break: break-word !important;
    }
    
    /* Segmented 分段控制器 - 全宽显示 */
    .ant-segmented {
        width: 100% !important;
    }
    .ant-segmented-item {
        flex: 1 !important;
    }
    
    /* Tabs 标签页 - 横向滚动 */
    .ant-tabs-nav {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    .ant-tabs-nav::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Steps 步骤条 - 横向滚动 */
    .ant-steps-horizontal {
        overflow-x: auto !important;
        min-width: max-content !important;
    }
    
    /* Pagination 分页 - 居中显示 */
    .ant-pagination {
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    /* Breadcrumb 面包屑 - 简化显示 */
    .ant-breadcrumb {
        font-size: 13px !important;
        max-width: 200px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    /* Dropdown 下拉菜单 - 触摸优化 */
    .ant-dropdown-menu-item {
        min-height: 40px !important;
        padding: 10px 16px !important;
    }
    
    /* Context Menu 右键菜单 - 触摸优化 */
    .ant-dropdown-menu,
    .ant-menu {
        max-height: calc(100vh - 32px) !important;
        overflow-y: auto !important;
    }
}
