/* ===== 唯品会全渠道ERP系统 - 主样式表 ===== */
:root {
    --primary: #1677ff;
    --primary-dark: #0958d9;
    --primary-light: #e6f4ff;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --info: #1677ff;
    --bg: #f0f2f5;
    --bg-white: #fff;
    --sidebar-bg: #001529;
    --sidebar-hover: #002140;
    --sidebar-active: #1677ff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.1);
    --transition: all .2s ease;
}

/* ========== 统计卡片组 ========== */
.stats-grid { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-card {
    flex: 1; min-width: 200px; background: #fff; border-radius: 8px;
    padding: 20px; box-shadow: var(--shadow); display: flex;
    align-items: center; gap: 16px; transition: var(--transition);
    text-decoration: none; color: inherit; cursor: default;
}
.stat-card.stat-card-link { cursor: pointer; }
.stat-card.stat-card-link:hover { box-shadow: var(--shadow-lg); }
.stat-card.stat-card-alert { background: #fff2f0; border: 1px solid #ffccc7; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon.blue { background: #e6f4ff; color: #1677ff; }
.stat-icon.green { background: #e6fffb; color: #00b96b; }
.stat-icon.orange { background: #fff7e6; color: #fa8c16; }
.stat-icon.red { background: #fff2f0; color: #ff4d4f; }
.stat-info h4 { font-size: 24px; font-weight: 700; color: #1f2937; margin-bottom: 4px; }
.stat-info p { font-size: 13px; color: #6b7280; }

/* ========== 图表 ========== */
.charts-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.chart-card { flex: 1; min-width: 450px; }
.chart-card:last-child { flex: 0 0 100%; min-width: 400px; }
.chart-body { height: 300px; position: relative; }
.chart-tabs { display: flex; gap: 4px; }
.chart-tab {
    padding: 4px 12px; border-radius: 4px; cursor: pointer;
    font-size: 13px; color: #6b7280; border: 1px solid #e5e7eb;
    transition: var(--transition); user-select: none;
}
.chart-tab.active { color: #1677ff; border-color: #1677ff; background: #e6f4ff; }
.chart-tab:hover { border-color: #1677ff; }

/* ========== 工具样式 ========== */
.text-danger { color: #ff4d4f !important; }
.text-warning { color: #fa8c16 !important; }
.text-success { color: #00b96b !important; }
.text-bold { font-weight: 600; }
.mb-16 { margin-bottom: 16px; }

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 14px; color: var(--text-primary); background: var(--bg); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar-bg); position: fixed; left: 0; top: 0; bottom: 0; z-index: 100; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-logo { padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo h2 { color: #fff; font-size: 18px; font-weight: 700; white-space: nowrap; }
.sidebar-logo span { color: #a0aec0; font-size: 12px; display: block; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav .nav-group { margin-bottom: 4px; }
.sidebar-nav .nav-group-title { padding: 12px 24px 6px; font-size: 11px; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .5px; }
.sidebar-nav .nav-item { display: flex; align-items: center; padding: 10px 24px; color: rgba(255,255,255,.65); transition: var(--transition); cursor: pointer; font-size: 14px; gap: 10px; }
.sidebar-nav .nav-item:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-nav .nav-item.active { color: #fff; background: var(--sidebar-active); }
.sidebar-nav .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 12px 24px; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.65); }
.sidebar-footer .user-info { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer .logout-btn { color: rgba(255,255,255,.65); cursor: pointer; font-size: 13px; }
.sidebar-footer .logout-btn:hover { color: #fff; }

/* 移动端汉堡按钮与遮罩（桌面端默认隐藏，手机端作为顶栏内联按钮） */
.menu-toggle { display: none; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }

.main-content { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.main-header { height: 56px; background: var(--bg-white); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow); }
.main-header .breadcrumb { font-size: 14px; color: var(--text-secondary); }
.main-header .breadcrumb span { color: var(--text-primary); }
.main-header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.main-body { flex: 1; padding: 24px; }

/* ===== Cards ===== */
.card { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 24px; }
.btn-export { padding: 5px 14px; border: 1px solid #1677ff; border-radius: 4px; background: #1677ff; color: #fff; font-size: 13px; cursor: pointer; }
.btn-export:hover { background: #0e63d6; }

/* ===== Stats Cards ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-card .stat-icon.blue { background: #e6f4ff; color: #1677ff; }
.stat-card .stat-icon.green { background: #f6ffed; color: #52c41a; }
.stat-card .stat-icon.orange { background: #fff7e6; color: #fa8c16; }
.stat-card .stat-icon.red { background: #fff2f0; color: #ff4d4f; }
.stat-card .stat-info h4 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-card .stat-info p { color: var(--text-secondary); font-size: 13px; }

/* ===== Search Form ===== */
.search-form { background: var(--bg-white); border-radius: var(--radius); padding: 16px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.search-form .form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.search-form .form-item { display: flex; flex-direction: column; gap: 4px; }
.search-form .form-item[style*="align-self:flex-end"] { flex-direction: row; gap: 8px; align-items: flex-end; }
.search-form .form-item label { font-size: 13px; color: var(--text-secondary); }
.search-form .form-item input,
.search-form .form-item select { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; min-width: 160px; transition: var(--transition); }
.search-form .form-item input:focus,
.search-form .form-item select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.15); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border: none; border-radius: var(--radius); font-size: 14px; cursor: pointer; transition: var(--transition); white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #389e0d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cf1322; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d48806; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: var(--primary-dark); }
.btn-default { background: #fff; color: var(--text-primary); border: 1px solid var(--border); }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--primary); padding: 0 4px; cursor: pointer; }
.btn-link:hover { color: var(--primary-dark); }
.btn-link.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== Table ===== */
.table-wrapper { background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-toolbar { padding: 12px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.table-toolbar .table-title { font-size: 15px; font-weight: 600; }
.table-toolbar-right { margin-left: auto; display: flex; gap: 8px; }
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table thead { background: #fafafa; }
table th { padding: 12px 16px; text-align: left; font-weight: 600; font-size: 13px; color: var(--text-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; }
table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
table tbody tr:hover { background: #fafafa; }
table .text-right { text-align: right; }
table .text-center { text-align: center; }
.table-footer { padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); }

/* ===== Status Badges ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 100px; font-size: 12px; font-weight: 500; }
.badge-blue { background: #e6f4ff; color: #1677ff; }
.badge-green { background: #f6ffed; color: #52c41a; }
.badge-orange { background: #fff7e6; color: #fa8c16; }
.badge-red { background: #fff2f0; color: #ff4d4f; }
.badge-gray { background: #f5f5f5; color: #8c8c8c; }
.badge-purple { background: #f9f0ff; color: #722ed1; }
.badge-cyan { background: #e6fffb; color: #13c2c2; }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination .page-item { min-width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 13px; background: #fff; }
.pagination .page-item:hover { border-color: var(--primary); color: var(--primary); }
.pagination .page-item.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-item.disabled { color: var(--text-muted); cursor: not-allowed; }
.pagination-info { font-size: 13px; color: var(--text-secondary); }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; align-items: center; justify-content: center; }
.modal { background: var(--bg-white); border-radius: 8px; box-shadow: var(--shadow-lg); width: 520px; max-height: 80vh; overflow-y: auto; }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { cursor: pointer; font-size: 18px; color: var(--text-secondary); background: none; border: none; }
.modal-body { padding: 24px; }
.modal-footer { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-primary); }
.form-group label .required { color: var(--danger); margin-left: 2px; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; transition: var(--transition); }
.form-group textarea { height: 80px; padding: 8px 12px; resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.15); }

/* ===== Login Page ===== */
.login-body { background: #f0f2f5; display: flex; min-height: 100vh; }
.login-wrapper { display: flex; width: 100%; min-height: 100vh; }
.login-left {
    flex: 1; background: linear-gradient(160deg, #001529 0%, #0958d9 100%);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: 80px 60px; position: relative; overflow: hidden;
}
.login-left::before {
    content: ''; position: absolute; top: -30%; right: -20%;
    width: 600px; height: 600px; border-radius: 50%;
    background: rgba(255,255,255,.03);
}
.login-left::after {
    content: ''; position: absolute; bottom: -20%; left: -10%;
    width: 400px; height: 400px; border-radius: 50%;
    background: rgba(255,255,255,.02);
}
.login-brand { text-align: center; margin-bottom: 48px; position: relative; z-index: 1; }
.login-logo-icon { margin-bottom: 20px; display: flex; justify-content: center; }
.login-logo-icon svg { width: 64px; height: 64px; }
.login-brand h1 { color: #fff; font-size: 32px; font-weight: 800; letter-spacing: 2px; margin-bottom: 8px; }
.login-brand p { color: rgba(255,255,255,.55); font-size: 15px; letter-spacing: 4px; }
.login-features { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 18px; }
.login-feature-item {
    display: flex; align-items: center; gap: 12px;
    color: rgba(255,255,255,.65); font-size: 14px;
}
.login-feature-item svg { width: 20px; height: 20px; flex-shrink: 0; color: rgba(255,255,255,.4); }
.login-right {
    flex: 0 0 480px; display: flex; align-items: center; justify-content: center;
    padding: 40px; background: #fff;
}
.login-card { width: 100%; max-width: 380px; }
.login-card-title { font-size: 26px; font-weight: 700; color: #1f2937; margin-bottom: 6px; }
.login-card-sub { color: #9ca3af; font-size: 14px; margin-bottom: 32px; }
.login-error {
    background: #fff2f0; color: #ff4d4f; padding: 10px 16px;
    border-radius: 6px; margin-bottom: 20px; font-size: 13px; display: none;
    border: 1px solid #ffccc7;
}
.login-input-group {
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px; height: 46px; border: 1px solid #d9d9d9;
    border-radius: 8px; margin-bottom: 16px; transition: all .2s;
    background: #fafafa;
}
.login-input-group:focus-within {
    border-color: #1677ff; box-shadow: 0 0 0 3px rgba(22,119,255,.1);
    background: #fff;
}
.login-input-group svg { width: 18px; height: 18px; flex-shrink: 0; color: #bfbfbf; }
.login-input-group input {
    flex: 1; height: 100%; border: none; outline: none;
    background: transparent; font-size: 14px; color: #1f2937;
}
.login-input-group input::placeholder { color: #bfbfbf; }
.login-btn {
    width: 100%; height: 46px; background: #1677ff; color: #fff;
    border: none; border-radius: 8px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: all .2s; margin-top: 4px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { background: #0958d9; box-shadow: 0 4px 12px rgba(22,119,255,.35); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }
.login-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite;
    display: inline-block;
}
@media (max-width: 768px) {
    .login-left { display: none; }
    .login-right { flex: 1; }
}

/* ===== Invoice ===== */
.invoice-page { background: #f5f5f5; padding: 40px 0; min-height: 100vh; }
.invoice-card { max-width: 800px; margin: 0 auto; background: #fff; padding: 48px; box-shadow: var(--shadow); }
.invoice-header { text-align: center; margin-bottom: 32px; }
.invoice-header h1 { font-size: 28px; font-weight: 700; }
.invoice-info { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 32px; }
.invoice-table th, .invoice-table td { padding: 10px 12px; border: 1px solid #e5e7eb; text-align: left; }
.invoice-table th { background: #f9fafb; font-weight: 600; }
.invoice-total { text-align: right; font-size: 18px; font-weight: 600; margin-bottom: 48px; }
.invoice-footer { text-align: center; color: var(--text-muted); font-size: 12px; }

/* ===== Utilities ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-bold { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Loading ===== */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.spinner { width: 40px; height: 40px; border: 3px solid #e5e7eb; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: slideIn .3s ease; min-width: 250px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 220px; transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin-right: 10px; flex-shrink: 0; border: none; background: transparent; color: #1f2937; border-radius: 8px; font-size: 20px; line-height: 1; cursor: pointer; }
    .menu-toggle:active { background: #f0f2f5; }
    .sidebar-overlay { display: none; }
    .sidebar-open .sidebar-overlay { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .search-form .form-row { flex-direction: column; }
    .login-card { width: 90%; padding: 24px; }
}

/* ===== Print ===== */
@media print {
    .sidebar, .main-header, .search-form, .btn { display: none !important; }
    .main-content { margin-left: 0; }
    .main-body { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===== 店铺多选下拉（订单列表同款，各列表页复用） ===== */
.shop-multiselect { position:relative; }
.ms-trigger { width:100%; min-width:150px; min-height:34px; padding:5px 10px; border:1px solid #d1d5db; border-radius:6px; background:#fff; color:#374151; font-size:13px; text-align:left; cursor:pointer; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:4px; }
.ms-trigger:hover { border-color:#1677ff; }
.ms-caret { color:#9ca3af; font-size:10px; margin-left:auto; }
.ms-chips { display:inline-flex; flex-wrap:wrap; gap:4px; align-items:center; }
.ms-placeholder { color:#9ca3af; }
.ms-chip { display:inline-flex; align-items:center; gap:4px; background:#eef4ff; color:#1677ff; border:1px solid #bcd4ff; border-radius:4px; padding:1px 6px; font-size:12px; white-space:nowrap; }
.ms-chip-x { cursor:pointer; font-style:normal; font-weight:700; }
.ms-chip-x:hover { color:#cf1322; }
.ms-panel { position:absolute; top:calc(100% + 4px); left:0; z-index:1000; width:280px; max-width:340px; background:#fff; border:1px solid #e5e7eb; border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.12); padding:6px; }
.ms-actions { display:flex; gap:12px; padding:4px 6px 6px; border-bottom:1px solid #f0f0f0; margin-bottom:4px; }
.ms-actions a { color:#1677ff; font-size:12px; cursor:pointer; text-decoration:none; }
.ms-list { max-height:280px; overflow-y:auto; }
.shop-opt { display:flex; align-items:center; gap:8px; padding:7px 8px; font-size:13px; color:#374151; cursor:pointer; border-radius:4px; user-select:none; white-space:nowrap; }
.shop-opt:hover { background:#f5f7fa; }
.shop-opt.selected { background:#eef4ff; color:#1677ff; font-weight:500; }
.shop-opt .ms-mark { width:14px; display:inline-flex; align-items:center; justify-content:center; color:#1677ff; font-size:13px; font-weight:700; flex:0 0 auto; }
.shop-opt .ms-name { overflow:hidden; text-overflow:ellipsis; }
