/* CDN结算系统 - 统一样式 */
:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1f2937;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-hover: #1e293b;
    --sidebar-active: #3b82f6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-700);
    font-size: 14px;
    line-height: 1.5;
}

/* 布局 */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 230px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 24px;
    color: var(--primary-light);
}

.logo-text {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
}

.logo-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.nav-menu {
    padding: 16px 0;
    list-style: none;
}

.nav-group-title {
    padding: 10px 20px 6px;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.nav-item a.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.nav-item i { width: 18px; text-align: center; }

/* 主内容区 */
.main-content {
    margin-left: 230px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    background: #fff;
    padding: 14px 28px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--dark);
}

.breadcrumb {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 3px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* 用户下拉菜单 */
.user-info:hover {
    background: rgba(59, 130, 246, 0.06);
    border-radius: 8px;
    padding: 4px 8px;
    margin: -4px -8px;
}
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    z-index: 1000;
    overflow: hidden;
}
.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.user-menu-item:hover {
    background: #f3f4f6;
    color: var(--primary);
}
.user-menu-item i {
    width: 16px;
    text-align: center;
    color: #6b7280;
}
.user-menu-item:hover i {
    color: var(--primary);
}

.page-content {
    padding: 24px 28px;
    flex: 1;
}

/* 卡片 */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
}

.card-body { padding: 20px; }

/* 统计卡 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--primary);
}

.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label i { font-size: 18px; opacity: 0.7; }

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 6px;
}

.stat-trend {
    font-size: 12px;
    color: var(--gray-500);
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 5px;
    border: 1px solid transparent;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: var(--gray-700);
    text-decoration: none;
    font-family: inherit;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-outline { background: #fff; border-color: var(--gray-300); }
.btn-default { background: #fff; border-color: var(--gray-300); color: var(--gray-700); }
.btn-default:hover { background: #f9fafb; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* 表格 */
.table-container {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.data-table tbody tr:hover { background: var(--gray-50); }

.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* 状态标签 */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #cffafe; color: #155e75; }
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-default { background: var(--gray-200); color: var(--gray-700); }

/* 表单 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--gray-700);
    font-weight: 500;
}

.form-group label .required { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal {
    background: #fff;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}

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

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

.modal-title { font-size: 16px; font-weight: 600; color: var(--dark); }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--gray-500);
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 4px;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    font-size: 13px;
    color: var(--gray-500);
}

.pagination-buttons { display: flex; gap: 5px; }

.page-btn {
    padding: 5px 10px;
    border: 1px solid var(--gray-300);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 结算单（发票样式）- 云商票据样板 */
.invoice-sheet {
    background: #fff;
    padding: 40px 50px;
    max-width: 900px;
    margin: 0 auto;
    font-family: "SimSun", "Songti SC", serif;
    color: #000;
    border: 1px solid #000;
}

.invoice-title {
    text-align: center;
    font-size: 26px;
    font-weight: bold;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.invoice-subtitle {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 13px;
    border-bottom: 2px double #000;
    padding-bottom: 10px;
}

.invoice-info-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 20px;
    margin-bottom: 15px;
    font-size: 13px;
    padding: 10px;
    border: 1px solid #000;
}

.invoice-info-block .info-row {
    display: flex;
}

.invoice-info-block .info-label {
    font-weight: bold;
    min-width: 80px;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    font-size: 13px;
}

.invoice-table th,
.invoice-table td {
    border: 1px solid #000;
    padding: 8px 10px;
    text-align: center;
}

.invoice-table th {
    background: #f5f5f5;
    font-weight: bold;
}

.invoice-table .text-right { text-align: right; }
.invoice-table .text-left { text-align: left; }

.invoice-total-row {
    background: #fffbeb;
    font-weight: bold;
}

.invoice-amount-words {
    padding: 10px;
    border: 1px solid #000;
    margin-bottom: 15px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
}

.invoice-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 15px 10px;
    font-size: 13px;
    border: 1px solid #000;
    margin-bottom: 15px;
}

.invoice-signatures {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding-top: 30px;
    font-size: 13px;
}

.invoice-signatures .sign-block {
    border-top: 1px solid #000;
    padding-top: 5px;
    text-align: center;
}

.invoice-stamp {
    position: absolute;
    right: 50px;
    top: 40%;
    width: 120px;
    height: 120px;
    border: 3px solid #dc2626;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-weight: bold;
    transform: rotate(-15deg);
    opacity: 0.7;
}

.invoice-wrapper {
    position: relative;
}

/* 打印样式 */
@media print {
    .sidebar, .top-bar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    body { background: #fff !important; }
    .invoice-sheet { border: 1px solid #000 !important; box-shadow: none !important; }
}

/* 工具类 */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-gray { color: var(--gray-500); }
.font-bold { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* 详情网格 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    padding: 16px 0;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--gray-500);
}

.detail-value {
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab-item {
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    transform: translateX(400px);
    transition: transform 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.show { transform: translateX(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .nav-group-title, .sidebar .logo-text, .sidebar .logo-sub, .nav-item a span { display: none; }
    .main-content { margin-left: 60px; }
    .page-content { padding: 16px; }
}
