/**
 * 订单管理系统 - 主样式文件
 * 黑白简洁风格
 */

/* ========================================
   CSS Variables - 设计令牌
   ======================================== */
:root {
    --primary: #18181b;
    --primary-hover: #27272a;
    --primary-foreground: #ffffff;
    --secondary: #f4f4f5;
    --secondary-hover: #e4e4e7;
    --background: #ffffff;
    --foreground: #18181b;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --border: #e4e4e7;
    --ring: #18181b;
    --radius: 6px;
    --destructive: #dc2626;
    --destructive-hover: #b91c1c;
    --warning: #f59e0b;
    --success: #22c55e;
    
    --sidebar-width: 220px;
    --sidebar-bg: #18181b;
    --card-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --card-shadow-hover: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    
    /* 统一文字大小 */
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 20px;
    --text-3xl: 24px;
}

/* ========================================
   Reset & Base
   ======================================== */
/* 全局横向滚动保护 - 只限制html和body，不影响其他元素 */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

main, .main-content, .dashboard-simple, .card, .table-wrapper, .card-content {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

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

html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--text-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: #fafafa;
    color: var(--foreground);
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   Layout - 布局
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h1 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-logo p {
    margin: 2px 0 0 0;
    font-size: var(--text-sm);
    opacity: 0.6;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    color: rgba(255,255,255,0.7);
    border-radius: 6px;
    margin-bottom: 2px;
    transition: all 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    font-size: var(--text-base);
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: white;
    font-weight: 500;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.main-content {
    margin-left: var(--sidebar-width) !important;
    min-height: 100vh !important;
    padding: 24px !important;
    overflow-x: hidden !important;
    width: calc(100% - var(--sidebar-width)) !important;
    max-width: 100% !important;
}

/* ========================================
   Page Header
   ======================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-subtitle {
    color: var(--muted-foreground);
    font-size: var(--text-sm);
    margin-top: 4px;
}

/* ========================================
   Current Time Clock
   ======================================== */
.current-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.time-large {
    font-size: 28px;
    font-weight: 700;
    color: var(--foreground);
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    line-height: 1;
}

.date-small {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-weight: 500;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
}

.card-description {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin-top: 4px;
}

.card-content {
    padding: 16px;
}

.card-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--muted);
}

/* ========================================
   Stats Cards - 统计卡片
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--background);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card .stat-icon.green {
    background: #f0fdf4;
    color: #16a34a;
}

.stat-card .stat-icon.blue {
    background: #eff6ff;
    color: #2563eb;
}

.stat-card .stat-icon.yellow {
    background: #fffbeb;
    color: #d97706;
}

.stat-card .stat-icon.red {
    background: #fef2f2;
    color: #dc2626;
}

.stat-card .stat-icon.gray {
    background: #f4f4f5;
    color: #52525b;
}

.stat-card .stat-icon.orange {
    background: #fff7ed;
    color: #ea580c;
}

.stat-card .stat-icon.purple {
    background: #faf5ff;
    color: #9333ea;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--muted-foreground);
    margin: 2px 0 0 0;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

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

.btn-secondary {
    background: #ffffff;
    color: var(--foreground);
    border: 1px solid #d4d4d8;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #a1a1aa;
    color: #27272a;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--foreground);
}

.btn-outline:hover {
    background: var(--secondary);
}

.btn-destructive {
    background: var(--destructive);
    color: white;
}

.btn-destructive:hover {
    background: var(--destructive-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--muted-foreground);
}

.btn-ghost:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.btn-sm {
    padding: 6px 12px;
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 12px 24px;
    font-size: var(--text-base);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 6px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: " *";
    color: var(--destructive);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: var(--text-base);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--foreground);
    transition: all 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.1);
}

.form-input::placeholder {
    color: var(--muted-foreground);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.form-help {
    font-size: 12px;
    color: var(--muted-foreground);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: var(--destructive);
    margin-top: 4px;
}

/* ========================================
   Tables
   ======================================== */
/* 桌面端：保持下拉菜单可见，表格全屏显示 */
@media (min-width: 769px) {
    .table-container {
        overflow-x: auto !important;
        width: 100% !important;
    }
    
    /* main-content 保持默认 padding */
    .main-content {
        padding: 16px !important;
    }
    
    /* 卡片正常显示，保持边距和圆角 */
    .card {
        overflow: hidden !important;
        margin: 0 0 16px 0 !important;
        border-radius: 8px !important;
    }
    
    /* 卡片标题区域 - 给左右padding */
    .card-header {
        padding: 12px 16px !important;
    }
    
    /* 卡片内容区域 - 保留默认padding */
    .card-content {
        padding: 12px !important;
    }
    
    /* 筛选表单卡片内容区域 - 有padding */
    .card.mb-4 .card-content {
        padding: 12px !important;
    }
    
    /* 页面标题区域 */
    .page-header {
        padding: 0;
        margin-bottom: 8px;
    }
    
    body,
    html {
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }
}

/* 移动端优化 - 使用卡片视图 */
@media (max-width: 768px) {
    /* 隐藏桌面端表格，显示卡片视图 */
    .table-container {
        display: none !important;
    }
    
    .mobile-card-view {
        display: block !important;
        padding: 12px;
    }
    
    /* 优化页面头部 */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .page-title {
        font-size: var(--text-xl) !important;
        text-align: center;
    }
    
    .page-actions {
        width: 100% !important;
        justify-content: center;
    }
    
    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    /* 优化筛选区域 */
    .card.mb-4 {
        margin-bottom: 12px !important;
    }
    
    .card.mb-4 .card-content {
        padding: 12px;
    }
    
    .card.mb-4 form {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .card.mb-4 .form-input,
    .card.mb-4 select {
        width: 100% !important;
        font-size: var(--text-base) !important;
    }
    
    .card.mb-4 .btn {
        width: 100% !important;
        justify-content: center;
    }
}

/* 默认隐藏移动端卡片视图，在桌面端隐藏 */
.mobile-card-view {
    display: none;
}

@media (min-width: 769px) {
    .mobile-card-view {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .mobile-card-view {
        display: block !important;
    }
}

.table-wrapper,
.payment-table-wrapper {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
}

.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: 100%;
}

.table th,
.table td {
    white-space: nowrap;
}

.table th {
    text-align: center;
    padding: 14px 16px;
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    background: var(--muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 16px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    text-align: left;
    font-size: var(--text-base);
}

.table tbody tr:hover {
    background: var(--muted);
}

.table-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted-foreground);
}

/* ========================================
   Order List Table (订单列表专用样式)
   ======================================== */
.order-list-table {
    font-size: 13px;
}

.order-list-table th {
    padding: 6px 5px !important;
    font-size: 11px !important;
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.order-list-table td {
    padding: 5px 5px !important;
    font-size: 12px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    vertical-align: middle !important;
}

.order-list-table tbody tr:hover {
    background: #f8fafc !important;
}

/* ========================================
   逾期/到期日醒目标识 (旧版保留兼容)
   ======================================== */

/* 逾期标识 - 红色脉冲动画 */
.overdue-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white !important;
    padding: 2px 8px 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    animation: overdue-pulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.overdue-days {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    color: white !important;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 8px;
    letter-spacing: -0.3px;
}

/* 今日到期标识 - 橙色脉冲动画 */
.due-today-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white !important;
    padding: 2px 8px 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    animation: due-today-pulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.due-today-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    color: white !important;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 8px;
}

/* 脉冲动画 */
@keyframes overdue-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 4px 16px rgba(220, 38, 38, 0.6);
    }
}

@keyframes due-today-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.6);
    }
}

/* ========================================
   Mobile Card View (移动端卡片视图)
   ======================================== */
.mobile-card-view .order-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mobile-card-view .order-card:last-child {
    margin-bottom: 0;
}

.mobile-card-view .order-card.bg-red-50 {
    border-left: 3px solid #dc2626;
}

.mobile-card-view .order-card.bg-yellow-50 {
    border-left: 3px solid #d97706;
}

.mobile-card-view .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.mobile-card-view .order-number {
    font-weight: 600;
    color: var(--foreground);
    font-size: 14px;
}

.mobile-card-view .order-body {
    margin-bottom: 8px;
}

.mobile-card-view .order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.mobile-card-view .order-label {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.mobile-card-view .order-value {
    font-weight: 500;
    text-align: right;
    margin-left: 8px;
    word-break: break-all;
}

.mobile-card-view .order-amount-row {
    margin: 8px 0;
    padding: 8px;
    background: var(--muted);
    border-radius: 6px;
}

.mobile-card-view .order-amount-main {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 4px;
}

.mobile-card-view .order-amount-detail {
    font-size: 12px;
    color: var(--muted-foreground);
    text-align: center;
}

.mobile-card-view .order-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.mobile-card-view .order-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 12px;
    padding: 6px 8px;
}

/* 移动端标签 */
.mobile-card-view .badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 3px;
}

.mobile-card-view .badge-success {
    background: #f0fdf4;
    color: #16a34a;
}

.mobile-card-view .badge-warning {
    background: #fffbeb;
    color: #d97706;
}

.mobile-card-view .badge-info {
    background: #eff6ff !important;
    color: #2563eb !important;
}

.mobile-card-view .badge-secondary {
    background: var(--secondary);
    color: var(--muted-foreground);
}

/* ========================================
   Mobile Card (通用移动端卡片 - purchasers/users等)
   ======================================== */
.mobile-card-view .mobile-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.mobile-card-view .mobile-card:last-child {
    margin-bottom: 0;
}

.mobile-card-view .mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.mobile-card-view .mobile-card-id {
    font-weight: 600;
    color: var(--foreground);
    font-size: 14px;
}

.mobile-card-view .mobile-card-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.mobile-card-view .mobile-card-status.status-active {
    background: #dcfce7;
    color: #166534;
}

.mobile-card-view .mobile-card-status.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.mobile-card-view .mobile-card-body {
    margin-bottom: 8px;
}

.mobile-card-view .mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}

.mobile-card-view .mobile-card-label {
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.mobile-card-view .mobile-card-value {
    font-weight: 500;
    text-align: right;
    margin-left: 8px;
    word-break: break-all;
}

.mobile-card-view .mobile-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.mobile-card-view .mobile-card-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
    font-size: 12px;
    padding: 6px 8px;
}

.mobile-card-view .mobile-empty {
    text-align: center;
    color: var(--muted-foreground);
    padding: 32px 16px;
    font-size: 14px;
}

/* ========================================
   移动端支付记录表格横向滚动
   ======================================== */
.payment-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
}

/* 桌面端支付记录表格 */
@media (min-width: 769px) {
    .payment-table-wrapper .table {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 768px) {
    /* 确保所有表格容器和卡片内容在移动端可以正常滚动 */
    .table-wrapper,
    .payment-table-wrapper,
    .card-content,
    .dashboard-simple {
        overflow-x: hidden !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .payment-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100vw !important;
        max-width: 100vw !important;
        position: relative;
        display: block;
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .payment-table-wrapper .table {
        min-width: 800px;
        width: 800px;
    }
    
    .payment-table-wrapper .table th,
    .payment-table-wrapper .table td {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* 确保普通表格在移动端也可以横向滚动 */
    .table-wrapper .table {
        min-width: 800px;
        width: 800px;
    }
    
    /* 移动端支付汇总优化 */
    .card .grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    
    .card .grid > div {
        padding: 12px !important;
    }
    
    .card .grid .text-lg {
        font-size: 16px !important;
    }
    
    /* 确保card-content不会限制滚动 */
    .card-content {
        overflow: visible !important;
    }
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
}

.badge-success {
    background: #f0fdf4;
    color: #16a34a;
}

.badge-warning {
    background: #fffbeb;
    color: #d97706;
}

.badge-info {
    background: #eff6ff;
    color: #2563eb;
}

.badge-error {
    background: #fef2f2;
    color: #dc2626;
}

.badge-secondary {
    background: var(--secondary);
    color: var(--muted-foreground);
}

/* ========================================
   Modals
   ======================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--background);
    border-radius: 8px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--card-shadow-hover);
}

.modal-lg {
    max-width: 640px;
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}

.modal-close:hover {
    background: var(--secondary);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========================================
   Alerts
   ======================================== */
.alert-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
    width: calc(100% - 32px);
}

.alert {
    padding: 14px 16px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

/* Alert 自动消失动画 */
.alert {
    position: relative;
    animation: alertSlideIn 0.3s ease;
}

.alert.fade-out {
    animation: alertSlideOut 0.3s ease forwards;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes alertSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100px) scale(0.95);
    }
}

/* ========================================
   Login Page
   ======================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #18181b;
    padding: 16px;
}

.login-box {
    background: var(--background);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--card-shadow-hover);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 4px 0;
}

.login-logo p {
    color: var(--muted-foreground);
    font-size: 13px;
    margin: 0;
}

/* ========================================
   Action Buttons
   ======================================== */
.action-btns {
    display: flex;
    gap: 6px;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--background);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.action-btn.primary:hover {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #16a34a;
}

.action-btn.warning:hover {
    background: #fffbeb;
    color: #d97706;
    border-color: #d97706;
}

.action-btn.danger:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #dc2626;
}

/* ========================================
   Filters
   ======================================== */
.filters-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filters-bar .form-input,
.filters-bar .form-select {
    width: auto;
    min-width: 140px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: white;
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    .menu-toggle {
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        color: var(--foreground);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-title {
        font-size: 16px;
        font-weight: 600;
    }
    
    /* main-content 移动端覆盖全局 !important */
    .main-content {
        margin-left: 0 !important;
        padding: 16px !important;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
        margin-bottom: 0;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 20px;
    }
    
    /* 卡片全屏显示 - 列表页面的表格卡片 */
    .card {
        margin: 0 0 16px 0 !important;
        border-radius: 8px !important;
    }
    
    /* 包含表格的卡片 - 全屏显示 */
    .card:has(.table) {
        margin: 0 -12px 16px -12px !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
    
    .card-header {
        padding: 12px !important;
    }
    
    /* 所有卡片内容区域默认有padding */
    .card-content {
        padding: 16px !important;
    }
    
    /* 只有包含.table的卡片才无padding */
    .card:has(.table) .card-content {
        padding: 0 !important;
    }
    
    /* 筛选表单卡片内容区域 - 有padding */
    .card.mb-4 .card-content {
        padding: 12px !important;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th, .table td {
        padding: 8px 10px;
    }
    
    .flex.gap-3 {
        gap: 6px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .page-actions {
        width: 100%;
    }
    
    .page-actions .btn {
        width: 100%;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .filters-bar .form-input,
    .filters-bar .form-select {
        width: 100%;
    }
}

/* 隐藏移动端头部在桌面端 */
.mobile-header {
    display: none;
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .sidebar .sidebar-logo {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .sidebar .close-sidebar {
        background: none;
        border: none;
        color: white;
        padding: 8px;
        cursor: pointer;
        display: flex;
    }
    
    /* 表格横向滚动 */
    .table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    /* 滚动条样式 */
    .table-container::-webkit-scrollbar {
        height: 6px;
    }
    
    .table-container::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 3px;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 3px;
    }
    
    .table-container::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.5);
    }

    /* 表单优化 */
    .form-input, .form-select {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    /* 弹窗优化 */
    .modal {
        margin: 12px;
        max-width: calc(100% - 24px);
    }
    
    /* 按钮组优化 */
    .action-btns {
        flex-wrap: wrap;
    }
    
    /* 邮箱标签优化 */
    .email-tag {
        display: flex;
        width: 100%;
        justify-content: space-between;
        margin: 4px 0;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 20px;
    }
    
    .login-logo h1 {
        font-size: 18px;
    }
    
    .stat-card .stat-icon {
        width: 32px;
        height: 32px;
    }
    
    .stat-card .stat-value {
        font-size: 18px;
    }
    
    .table th, .table td {
        padding: 6px;
        font-size: 11px;
    }
    
    .btn-sm {
        padding: 3px 6px;
        font-size: 11px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--destructive); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

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

.py-8 { padding-top: 32px; padding-bottom: 32px; }
.p-0 { padding: 0; }

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.grid { 
    display: grid; 
}
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Dropdown Menu - 下拉菜单
   ======================================== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none !important;
}

.dropdown-menu.show {
    display: block !important;
}

/* 用户信息区域 */
.user-info {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.user-info .user-name {
    font-size: var(--text-sm);
    font-weight: 500;
}

.user-info .user-role {
    font-size: var(--text-xs);
    opacity: 0.6;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin-top: 8px;
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--text-sm);
    transition: all 0.15s;
    text-decoration: none;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
}

/* 邮件模板样式 */
.email-template-box {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.6;
    min-height: 200px;
    resize: vertical;
}

.variable-list {
    background: #fafafa;
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

.variable-list h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.variable-list ul {
    margin: 0;
    padding-left: 20px;
    font-size: 12px;
    color: var(--muted-foreground);
}

.variable-list li {
    margin-bottom: 4px;
}

.variable-list code {
    background: #e4e4e7;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
}

/* lg 网格 */
@media (min-width: 1024px) {
    .lg-grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 文本大小 */
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }

/* ========================================
   File Upload - 文件上传组件（优化版）
   ======================================== */

.file-upload-area {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    transition: all 0.25s ease;
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    overflow: hidden;
}

.file-upload-area:hover {
    border-color: #9ca3af;
    background: linear-gradient(135deg, #f3f4f6 0%, #fafafa 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.file-upload-area:active {
    transform: translateY(0);
}

.file-upload-area.drag-over {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    min-height: 140px;
    position: relative;
    z-index: 5;
}

.file-preview img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-preview img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.12), 0 4px 6px rgba(0, 0, 0, 0.08);
}

.preview-item {
    position: relative;
    display: inline-block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-item img {
    max-width: 160px;
    max-height: 160px;
    border: 2px solid white;
}

.file-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 28px;
    height: 28px;
    background: #ef4444;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.file-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

.file-remove:active {
    transform: scale(0.95);
}

.file-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    padding: 24px;
    min-width: 220px;
}

.file-placeholder svg {
    width: 48px;
    height: 48px;
    color: #9ca3af;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.file-upload-area:hover .file-placeholder svg {
    color: #6b7280;
    transform: translateY(-2px);
}

.file-placeholder p {
    margin: 6px 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}

.file-placeholder p:first-of-type {
    color: #374151;
    font-weight: 600;
}

.file-placeholder .upload-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.file-placeholder .upload-limit {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
    padding: 4px 12px;
    background: #f3f4f6;
    border-radius: 12px;
}

.file-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    padding: 48px;
    gap: 12px;
}

.file-loading::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s ease-in-out infinite;
}

.file-loading p {
    font-size: 14px;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 凭证缩略图（在表格中） */
.proof-thumb {
    display: inline-block;
    position: relative;
    width: 52px;
    height: 52px;
    overflow: hidden;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.proof-thumb:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.proof-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modal中的文件上传区域调整 */
.modal-content .file-upload-area {
    padding: 24px 20px;
    border-radius: 10px;
}

.modal-content .file-preview {
    min-height: 110px;
}

.modal-content .file-preview img {
    max-height: 220px;
}

.modal-content .file-placeholder {
    padding: 18px;
    min-width: 170px;
}

.modal-content .file-placeholder svg {
    width: 40px;
    height: 40px;
}

/* 优化的支付记录弹窗样式 */
.modal-content .form-input:focus {
    outline: none;
    border-color: #18181b;
    box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.1);
    background: white;
}

.modal-content .form-input:hover {
    border-color: #a1a1aa;
}

/* 支付类型按钮选中状态 */
.payment-type-btn:active {
    transform: scale(0.98);
}

.payment-type-btn:hover {
    border-color: #a1a1aa;
    background: linear-gradient(135deg, #fafafa 0%, #f4f4f5 100%);
    transform: translateY(-1px);
}

/* 按钮悬停效果 */
.modal-content .btn-primary:hover {
    background: linear-gradient(135deg, #27272a 0%, #3f3f46 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 24, 27, 0.3);
}

.modal-content .btn-primary:active {
    transform: translateY(0);
}

.modal-content .btn-secondary:hover {
    background: #e4e4e7;
}

.modal-content .modal-close:hover {
    background: #e4e4e7;
    color: #18181b;
}

/* 弹窗打开动画 */
.modal {
    animation: modalFadeIn 0.2s ease;
}

.modal-content {
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.98);
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
}

/* 文件上传区域标签优化 */
.form-group .form-label {
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.form-group .form-label small {
    font-weight: normal;
    color: #9ca3af;
    font-size: 12px;
    margin-left: 6px;
}

.form-group .text-muted {
    color: #6b7280;
    font-size: 13px;
    margin-top: 6px;
    line-height: 1.5;
}

/* ========================================
   权限弹窗样式
   ======================================== */
.permission-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.permission-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

.permission-modal-header {
    padding: 32px 24px 24px;
    text-align: center;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.permission-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.3);
}

.permission-modal-body {
    padding: 24px;
}

.permission-modal-footer {
    padding: 0 24px 24px;
}

.permission-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.2);
}

.permission-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(31, 41, 55, 0.3);
}

.permission-btn:active {
    transform: translateY(0);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 支付记录弹窗 - 全屏显示 */
#paymentModal {
    max-width: none !important;
    width: 100% !important;
}

#paymentModalContent {
    max-width: 100% !important;
    width: calc(100vw - 64px) !important;
    max-height: calc(100vh - 64px) !important;
}

/* ========================================
   工具类 (Utility Classes)
   ======================================== */
/* Flexbox 工具类 */
.flex {
    display: flex !important;
}

.flex-col {
    flex-direction: column !important;
}

.items-center {
    align-items: center !important;
}

.justify-between {
    justify-content: space-between !important;
}

.justify-center {
    justify-content: center !important;
}

/* Gap 工具类 */
.gap-1 {
    gap: 4px !important;
}

.gap-2 {
    gap: 8px !important;
}

.gap-3 {
    gap: 12px !important;
}

.gap-4 {
    gap: 16px !important;
}

/* Grid 工具类 */
.grid {
    display: grid !important;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, 1fr) !important;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

.md\:grid-cols-2 {
    @media (min-width: 769px) {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.md\:col-span-2 {
    @media (min-width: 769px) {
        grid-column: span 2 / span 2 !important;
    }
}

/* 文本工具类 */
.text-center {
    text-align: center !important;
}

.text-sm {
    font-size: var(--text-sm) !important;
}

.text-muted {
    color: var(--muted-foreground) !important;
}

.font-semibold {
    font-weight: 600 !important;
}

.font-medium {
    font-weight: 500 !important;
}

.text-red-500 {
    color: #ef4444 !important;
}

/* 间距工具类 */
.mt-1 {
    margin-top: 4px !important;
}

.mt-2 {
    margin-top: 8px !important;
}

.mt-3 {
    margin-top: 12px !important;
}

.mt-4 {
    margin-top: 16px !important;
}

.mt-8 {
    margin-top: 32px !important;
}

.mb-4 {
    margin-bottom: 16px !important;
}

.py-8 {
    padding-top: 32px !important;
    padding-bottom: 32px !important;
}

.p-0 {
    padding: 0 !important;
}

/* 宽度工具类 */
.w-full {
    width: 100% !important;
}

/* 响应式显示工具类 */
.desktop-only {
    display: block !important;
}

.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: block !important;
    }
}

/* 徽章样式 */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef9c3;
    color: #854d0e;
}

.badge-info {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-secondary {
    background: #f4f4f5;
    color: #52525b;
}

/* 表单样式补充 */
.form-grid {
    display: grid !important;
    grid-template-columns: repeat(1, 1fr) !important;
    gap: 16px !important;
}

@media (min-width: 769px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--foreground);
}

.form-label.required::after {
    content: ' *';
    color: #ef4444;
}

/* 按钮大小补充 */
.btn-sm {
    padding: 6px 12px !important;
    font-size: var(--text-sm) !important;
}

.btn-lg {
    padding: 10px 20px !important;
    font-size: var(--text-base) !important;
}

/* 页面操作区 */
.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 警告提示样式 */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: alertSlideIn 0.3s ease;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

@keyframes alertSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Dashboard Simple 样式 (控制面板)
   ======================================== */
.dashboard-simple {
    width: 100%;
    overflow-x: hidden;
}

.page-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e4e4e7;
}

.page-title-simple {
    font-size: var(--text-2xl);
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

.page-time-simple {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

.section-wrapper-simple {
    margin-bottom: 16px;
}

.section-title-simple {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--foreground);
    margin: 0 0 16px 0;
    padding-left: 10px;
    border-left: 4px solid #6366f1;
}

.stats-grid-simple {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-link-simple {
    text-decoration: none;
    display: block;
    transition: transform 0.2s ease;
}

.stat-link-simple:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.stat-card-simple {
    background: white;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-link-simple:hover .stat-card-simple {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d4d4d8;
}

.stat-card-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-value-simple {
    font-size: 28px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 4px 0;
    line-height: 1.1;
}

.stat-label-simple {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin: 0;
}

.stat-icon-simple {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-simple.primary {
    background: #eff6ff;
    color: #3b82f6;
}

.stat-icon-simple.warning {
    background: #fffbeb;
    color: #f59e0b;
}

.stat-icon-simple.info {
    background: #f0f9ff;
    color: #0ea5e9;
}

.stat-icon-simple.success {
    background: #f0fdf4;
    color: #22c55e;
}

.stat-icon-simple.orange {
    background: #fff7ed;
    color: #f97316;
}

/* 移动端 Dashboard 样式 */
.mobile-order-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.total-card-simple {
    background: white;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.total-card-simple.warning {
    border-left: 4px solid #f59e0b;
}

.total-card-simple.blue {
    border-left: 4px solid #3b82f6;
}

.total-card-simple.green {
    border-left: 4px solid #22c55e;
}

.total-label-simple {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin: 0 0 6px 0;
}

.total-value-simple {
    font-size: 24px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

/* ========================================
   移动端卡片视图样式
   ======================================== */
.mobile-card-view {
    display: none;
}

@media (max-width: 768px) {
    .mobile-card-view {
        display: block;
    }
}

.order-card {
    background: white;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px;
    background: #fafafa;
    border-bottom: 1px solid #f4f4f5;
}

.order-number {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--foreground);
}

.order-body {
    padding: 14px 16px;
}

.order-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.order-row:last-child {
    margin-bottom: 0;
}

.order-label {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    flex-shrink: 0;
    margin-right: 12px;
}

.order-value {
    font-size: var(--text-sm);
    color: var(--foreground);
    text-align: right;
    word-break: break-word;
}

.order-actions {
    padding: 12px 16px;
    border-top: 1px solid #f4f4f5;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ========================================
   首页时间显示与横向滚动条修复
   ======================================== */
/* 确保首页时间正常显示 - 不被外部CSS覆盖 */
.page-header-simple {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

.page-time-simple {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 彻底解决横向滚动条问题 - 禁止页面级别的横向溢出，但允许表格容器滚动 */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
}

/* 允许表格容器横向滚动 */
.table-wrapper,
.payment-table-wrapper {
    overflow-x: auto !important;
    overflow-y: visible !important;
    width: 100% !important;
    max-width: 100% !important;
}

.dashboard-simple, .card, .card-content {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

