/* ========== 全局重置与基础 ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #059669;
    --success-hover: #047857;
    --warning: #d97706;
    --warning-hover: #b45309;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== 顶部导航 ========== */
.header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-subtitle {
    font-size: 12px;
    color: var(--text-light);
    background: rgba(255,255,255,0.1);
    padding: 2px 10px;
    border-radius: 12px;
}

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

.status-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.status-badge.connected {
    background: rgba(5, 150, 105, 0.2);
    color: #34d399;
}

.status-badge.disconnected {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

.header-time {
    font-size: 13px;
    color: var(--text-light);
}

/* ========== 主布局 ========== */
.main-content {
    display: flex;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.nav-menu {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 12px 16px;
    text-align: left;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
}

.nav-btn.active {
    background: var(--primary);
    color: #fff;
    font-weight: 500;
}

.nav-icon {
    font-size: 18px;
}

/* ========== 日志面板 ========== */
.log-panel {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 12px;
    display: flex;
    flex-direction: column;
    max-height: 220px;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.log-container {
    flex: 1;
    overflow-y: auto;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 180px;
}

.log-entry {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    word-break: break-all;
    line-height: 1.4;
}

.log-info { background: rgba(59,130,246,0.15); color: #93c5fd; }
.log-success { background: rgba(5,150,105,0.15); color: #6ee7b7; }
.log-warning { background: rgba(217,119,6,0.15); color: #fcd34d; }
.log-error { background: rgba(220,38,38,0.15); color: #fca5a5; }

/* ========== 内容区 ========== */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.panel-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.panel-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ========== 卡片 ========== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.card-icon {
    font-size: 28px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.card-status {
    margin-left: auto;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.card-status.connected {
    background: #d1fae5;
    color: var(--success);
}

.card-status.disconnected {
    background: #fee2e2;
    color: var(--danger);
}

.card-body {
    padding: 16px 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed #f1f5f9;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--text);
    font-weight: 500;
}

.version-text {
    font-size: 11px;
    color: var(--text-light);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* ========== 按钮 ========== */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

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

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

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

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover:not(:disabled) {
    background: var(--warning-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
}

.btn-mini {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-mini:hover:not(:disabled) {
    background: #f1f5f9;
}

/* ========== 操作栏 ========== */
.action-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}

.count-badge {
    background: var(--primary);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ========== 表格 ========== */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.search-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    width: 240px;
    outline: none;
    transition: border-color var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.1);
}

.table-title {
    font-weight: 600;
    font-size: 14px;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
}

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

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr.clickable {
    cursor: pointer;
}

.empty-hint {
    text-align: center;
    color: var(--text-light);
    padding: 30px !important;
    font-size: 14px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 8px;
    text-decoration: underline;
}

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

.btn-sm {
    padding: 3px 10px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    background: var(--bg-card);
    margin-right: 4px;
    transition: all var(--transition);
}

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

/* ========== 同步步骤指示器 ========== */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    transition: all var(--transition);
}

.step.done .step-number {
    background: var(--success);
    color: #fff;
}

.step.active .step-number {
    background: var(--primary);
    color: #fff;
    animation: pulse 1.5s infinite;
}

.step-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.step-connector {
    width: 60px;
    height: 2px;
    background: #e2e8f0;
    margin: 0 8px;
    margin-bottom: 20px;
}

.step.done + .step-connector {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0.4); }
    50% { box-shadow: 0 0 0 10px rgba(79,70,229,0); }
}

/* ========== 模态框 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 80%;
    max-width: 800px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h3 {
    font-size: 16px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--danger);
}

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

/* ========== 本地数据布局 ========== */
.local-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: 500px;
}

.local-table-list {
    border-right: 1px solid var(--border);
    padding: 16px;
    background: #f8fafc;
}

.local-table-list h4 {
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.select-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.select-item {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.select-item:hover {
    background: #e2e8f0;
}

.select-item.active {
    background: var(--primary);
    color: #fff;
}

.select-item .item-count {
    font-size: 11px;
    opacity: 0.7;
}

.local-data-view {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.data-table-wrapper {
    overflow-x: auto;
}

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

.data-table-wrapper th {
    background: #f1f5f9;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table-wrapper td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table-wrapper tbody tr:hover {
    background: #f8fafc;
}

/* ========== 进度条 ========== */
.progress-container {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.progress-percent {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
}

.progress-status {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 2px 10px;
    background: var(--bg-page);
    border-radius: 12px;
}

.progress-bar {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #38bdf8, var(--success));
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 0.3s ease, background-position 1s linear;
    width: 0%;
    position: relative;
}

.progress-fill.animating {
    animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-info {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
    line-height: 1.5;
}

.progress-detail {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 3px 8px;
    background: rgba(99,102,241,0.08);
    border-radius: 4px;
}

.sync-mode-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}

.sync-mode-label:hover {
    background: #f1f5f9;
}

.sync-mode-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: #fff;
    font-size: 14px;
}

/* ========== 提示消息 ========== */
.toast-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 400;
    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 0.3s ease;
    min-width: 280px;
    max-width: 400px;
}

.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; }
}

/* ========== 信息面板 ========== */
.info-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-top: 16px;
}

.info-panel h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.drivers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.driver-tag {
    background: #e0e7ff;
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========== 零售数据分析 ========== */

.retail-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    padding: 12px 0;
    margin-bottom: 20px;
}

.retail-date-picker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    outline: none;
    transition: border-color var(--transition);
}

.date-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.retail-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.retail-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}

.retail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.retail-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.retail-card-icon {
    font-size: 24px;
}

.retail-card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.retail-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

.retail-card-sub {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.rate-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    background: #f1f5f9;
    color: var(--text-secondary);
}

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

.rate-badge.down {
    background: #ecfdf5;
    color: #059669;
}

.text-muted {
    color: var(--text-light);
    font-size: 12px;
}

.retail-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.retail-chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.retail-hourly-card {
    margin-bottom: 24px;
}

.chart-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.chart-card-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.retail-table-scroll {
    max-height: 520px;
    overflow-y: auto;
}

.retail-table {
    font-size: 13px;
}

.retail-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
}

.hourly-chart-container {
    padding: 20px;
}

.hourly-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 200px;
    padding: 0 10px;
    border-bottom: 2px solid var(--border);
}

.hourly-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.hourly-bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    min-height: 2px;
    cursor: pointer;
    position: relative;
}

.hourly-bar:hover {
    background: linear-gradient(180deg, #a5b4fc 0%, #6366f1 100%);
}

.hourly-bar-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
    margin-bottom: 4px;
}

.hourly-bar:hover .hourly-bar-tooltip {
    display: block;
}

.hourly-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
}

.retail-deep-card {
    margin-bottom: 24px;
}

.deep-analysis-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 10px;
}

.deep-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 20px;
}

.deep-summary-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.deep-summary-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.deep-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.deep-summary-value.down {
    color: #ef4444;
}

.deep-summary-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.deep-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    padding: 0 20px;
}

.deep-tab {
    padding: 10px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.deep-tab:hover {
    color: var(--primary);
}

.deep-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.deep-tab-panel {
    display: none;
}

.deep-tab-panel.active {
    display: block;
}

.deep-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px 20px;
}

.deep-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.deep-col-header.up {
    background: #f0fdf4;
    color: #16a34a;
}

.deep-col-header.down {
    background: #fef2f2;
    color: #dc2626;
}

.deep-arrow {
    font-size: 16px;
}

.deep-count {
    margin-left: auto;
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.deep-table-scroll {
    max-height: 400px;
    overflow-y: auto;
}

.deep-table {
    font-size: 13px;
}

.deep-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    font-size: 11px;
}

.deep-table td {
    font-size: 12px;
}

.change-up {
    color: #16a34a;
    font-weight: 600;
}

.change-down {
    color: #dc2626;
    font-weight: 600;
}

.rank-cell {
    font-weight: 700;
    text-align: center;
}

.rank-top {
    color: var(--primary);
    font-size: 16px;
}

.rank-normal {
    color: var(--text-secondary);
}

.code-cell {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

.money-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.profit-cell {
    color: var(--success);
}

.num-cell {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ========== 响应式 ========== */

/* ========== 小程序管理 ========== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.image-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    background: #fff;
    transition: box-shadow 0.2s;
    position: relative;
}
.image-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.image-card .img-wrapper {
    width: 100%;
    height: 140px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
}
.image-card .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-card .img-wrapper .no-image {
    color: #bbb;
    font-size: 40px;
}
.image-card .img-wrapper .upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 6px;
}
.image-card .img-wrapper:hover .upload-overlay {
    opacity: 1;
}
.image-card .img-wrapper .upload-overlay span {
    color: #fff;
    font-size: 14px;
}
.image-card .card-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.image-card .card-info {
    font-size: 12px;
    color: #999;
}
.image-card .card-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    justify-content: center;
}
.image-card .card-actions .btn {
    font-size: 12px;
    padding: 3px 10px;
}
.listed-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}
.listed-no-img {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    color: #ccc;
    font-size: 18px;
}
.status-badge-listed {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge-listed.on-sale {
    background: #e8f5e9;
    color: #2e7d32;
}
.status-badge-listed.off-sale {
    background: #fce4ec;
    color: #c62828;
}
.status-badge-listed.sold-out {
    background: #ff7a45;
    color: #fff;
}
.unit-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    background: #f0f0f0;
    color: #666;
    margin: 0 2px;
    white-space: nowrap;
}
.unit-tag.primary {
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 500;
}
.unit-tag.warning {
    background: #fff3e0;
    color: #e65100;
    font-weight: 500;
}
.unit-check {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0 2px;
    gap: 2px;
}
.unit-check input[type=checkbox] {
    width: 13px;
    height: 13px;
    cursor: pointer;
    accent-color: var(--primary, #4f46e5);
    flex-shrink: 0;
}
.miniapp-stat-cards {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.miniapp-stat-card {
    flex: 1;
    min-width: 140px;
    padding: 16px;
    border-radius: 8px;
    background: #f8f9fa;
    text-align: center;
}
.miniapp-stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1976d2;
}
.miniapp-stat-card .stat-label {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.module {
    display: none;
}

.module.active {
    display: block;
}

.module-header {
    margin-bottom: 20px;
}

.module-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.module-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.settings-icon {
    font-size: 28px;
}

.settings-card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.settings-card-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.settings-status {
    margin-left: auto;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.settings-status.checked {
    background: #d1fae5;
    color: var(--success);
}

.settings-status.unchecked {
    background: #fee2e2;
    color: var(--danger);
}

.settings-card-body {
    padding: 20px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.settings-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary, #4f46e5);
}

.settings-card-icon {
    font-size: 24px;
}

.settings-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* 页面设置分页样式 */
.page-settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e8e8e8;
    margin-top: 16px;
}

.page-settings-tab {
    padding: 12px 24px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    color: #666;
    transition: all 0.2s;
    user-select: none;
}

.page-settings-tab:hover {
    color: #1890ff;
    background: #f0f7ff;
}

.page-settings-tab.active {
    color: #1890ff;
    font-weight: 600;
    border-bottom-color: #1890ff;
}

.page-settings-panel {
    display: none;
    margin-top: 16px;
}

.page-settings-panel.active {
    display: block;
}

.page-settings-home-intro {
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff, #f8fbff);
}

.page-settings-home-intro strong {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
    color: #1e3a8a;
}

.page-settings-home-intro p {
    margin: 0;
    color: #475569;
    font-size: 13px;
}

.page-settings-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.page-settings-home-entry {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 18px 16px;
    border: 1px solid #dbe3f0;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.page-settings-home-entry:hover,
.page-settings-home-entry.is-active {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 14px 28px rgba(59, 130, 246, 0.12);
}

.page-settings-home-entry-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
    font-size: 22px;
}

.page-settings-home-entry-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.page-settings-home-entry-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
}

.page-settings-home-section-host {
    display: none;
}

.page-settings-home-section {
    display: block;
}

.page-settings-home-modal {
    position: fixed;
    inset: 0;
    z-index: 2600;
    padding: 36px;
    background: rgba(15, 23, 42, 0.45);
}

.page-settings-home-modal-dialog {
    width: min(1100px, calc(100vw - 72px));
    max-height: calc(100vh - 72px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.page-settings-home-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.page-settings-home-modal-header h4 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #0f172a;
}

.page-settings-home-modal-header p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.page-settings-home-modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.page-settings-home-modal-body {
    padding: 20px 22px 24px;
    overflow: auto;
}

.page-settings-home-modal-body .page-settings-home-section {
    display: block;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-select-wrapper {
    position: relative;
}

.form-select {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    appearance: auto;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.branch-info {
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
}

.help-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.help-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.help-item strong {
    font-size: 14px;
    color: var(--text);
    display: block;
    margin-bottom: 2px;
}

.help-item p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.sub-nav {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sub-nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.sub-nav-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

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

.sub-nav-icon {
    font-size: 16px;
}

.sub-nav-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 20px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 24px;
}

.retail-sub-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 24px 28px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    width: 100%;
}

.retail-sub-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

.retail-sub-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.retail-sub-btn.active .sub-nav-hint {
    color: rgba(255, 255, 255, 0.75);
}

.retail-sub-btn .sub-nav-icon {
    font-size: 28px;
}

.retail-sub-btn .sub-nav-label {
    font-size: 18px;
    font-weight: 600;
}

.retail-sub-btn .sub-nav-hint {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================================
   AI决策中心样式
   ============================================================ */

/* AI Sub Nav - 网格布局 */
.ai-sub-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    width: 100%;
    text-align: center;
}

.ai-sub-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    transform: translateY(-2px);
}

.ai-sub-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.ai-sub-btn .sub-nav-icon {
    font-size: 24px;
}

.ai-sub-btn .sub-nav-label {
    font-size: 13px;
    font-weight: 600;
}

/* AI Sub Nav Grid */
.sub-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* AI Panel */
.sub-content .panel {
    display: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border: 1px solid var(--border);
}

.sub-content .panel.active {
    display: block;
}

.miniapp-feature-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.miniapp-sub-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 104px;
    padding: 16px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow);
    color: var(--text-secondary);
    text-align: center;
    width: 100%;
}

.miniapp-sub-btn:hover,
.miniapp-sub-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eef2ff 0%, #f8faff 100%);
    color: var(--primary);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.14);
    transform: translateY(-2px);
}

.miniapp-sub-btn .sub-nav-icon {
    font-size: 28px;
}

.miniapp-sub-btn .sub-nav-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.miniapp-sub-btn .sub-nav-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.miniapp-modal-trigger-tip {
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.miniapp-panel-host {
    display: none;
}

.miniapp-panel-host .panel {
    display: block;
    margin-bottom: 0;
}

.miniapp-feature-modal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(15, 23, 42, 0.56);
    padding: 24px;
}

.miniapp-feature-modal-dialog {
    width: min(1440px, 96vw);
    height: calc(100vh - 48px);
    margin: 0 auto;
    background: var(--bg);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.miniapp-feature-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 2;
    flex-shrink: 0;
}

.miniapp-feature-modal-header h3 {
    font-size: 22px;
    margin: 0 0 4px;
}

.miniapp-feature-modal-header p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.miniapp-feature-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.miniapp-feature-modal-action-btn,
.miniapp-feature-modal-close,
.miniapp-image-preview-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
}

.miniapp-feature-modal-action-btn {
    font-size: 16px;
    font-weight: 700;
}

.miniapp-feature-modal.fullscreen {
    padding: 0;
}

.miniapp-feature-modal.fullscreen .miniapp-feature-modal-dialog {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.miniapp-feature-modal-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    padding: 0 24px 24px;
}

.miniapp-feature-modal-body .panel {
    display: block !important;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    height: 100%;
    overflow: auto;
    min-height: 0;
}

.miniapp-feature-modal-body .panel.modalized-panel.miniapp-has-detail-scroll {
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}

.miniapp-feature-modal-body .panel.modalized-panel.miniapp-has-detail-scroll > * {
    flex-shrink: 0;
}

.miniapp-feature-modal-body .panel.modalized-panel > .panel-title,
.miniapp-feature-modal-body .panel.modalized-panel > .panel-desc {
    display: none;
}

.miniapp-feature-modal-body .panel.modalized-panel > .settings-section > h3:first-child {
    display: none;
}

.miniapp-feature-modal-body .panel .miniapp-sticky-toolbar {
    position: sticky;
    top: var(--miniapp-sticky-top, 0px);
    z-index: 1;
    background: var(--bg);
    padding-top: 10px;
    padding-bottom: 6px;
    margin-top: 0;
    margin-bottom: 6px;
    box-shadow: 0 1px 0 rgba(226, 232, 240, 0.95);
}

.miniapp-feature-modal-body .panel.modalized-panel .miniapp-detail-scroll-region {
    flex: 1 1 auto;
    min-height: 260px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}

.miniapp-feature-modal-body .panel.modalized-panel .data-table-wrapper th {
    position: sticky;
    top: var(--miniapp-sticky-header-top, 0px);
    z-index: 2;
    background: #f1f5f9;
    background-clip: padding-box;
}

.miniapp-feature-modal-body .panel.modalized-panel .data-table-wrapper table {
    border-collapse: separate;
    border-spacing: 0;
}

.miniapp-feature-modal-body .panel.modalized-panel .data-table-wrapper thead th {
    box-shadow: inset 0 -1px 0 rgba(226, 232, 240, 0.95);
}

.miniapp-feature-modal-body .panel.modalized-panel .data-table-wrapper tbody td {
    background: var(--bg);
}

.miniapp-feature-modal-body .panel.modalized-panel .miniapp-detail-scroll-region.data-table-wrapper th,
.miniapp-feature-modal-body .panel.modalized-panel .miniapp-detail-scroll-region .data-table-wrapper th,
.miniapp-feature-modal-body .panel.modalized-panel .miniapp-detail-scroll-region.table-scroll th,
.miniapp-feature-modal-body .panel.modalized-panel .miniapp-detail-scroll-region .table-scroll th {
    top: 0;
}

.miniapp-image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1600;
}

.miniapp-image-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
}

.miniapp-image-preview-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.miniapp-image-preview-dialog img {
    max-width: min(92vw, 1400px);
    max-height: 88vh;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    background: #fff;
}

.miniapp-image-preview-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255,255,255,0.92);
}

.miniapp-feature-modal-restore {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1490;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: #fff;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.miniapp-feature-modal-restore-icon {
    font-size: 18px;
}

/* AI Dashboard 卡片 */
.dash-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--transition);
}

.dash-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.dash-card-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-card-header span {
    font-size: 18px;
}

.dash-card-body {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.dash-val {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.dash-lbl {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Expiry Warning List */
.expiry-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.expiry-item {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px;
    transition: all var(--transition);
}

.expiry-item.severe {
    background: #fef2f2;
    border-color: #fecaca;
}

.expiry-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.expiry-item-name {
    font-weight: 600;
    font-size: 14px;
}

.expiry-item-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.expiry-item-badge.danger {
    background: #fee2e2;
    color: #dc2626;
}

.expiry-item-badge.warning {
    background: #fef3c7;
    color: #d97706;
}

.expiry-item-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.expiry-item-solutions {
    font-size: 12px;
    margin-top: 6px;
}

.expiry-item-solutions strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text);
}

.solution-tag {
    display: inline-block;
    background: #e0e7ff;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    margin: 2px;
}

/* Form Input */
.form-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    outline: none;
    transition: border-color var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* AI Profit Loss Info Panel */
#aiProfitLoss, #aiModeInfo, #aiDisplayTips {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}

#aiProfitLoss h4, #aiModeInfo h4, #aiDisplayTips h4 {
    font-size: 15px;
    margin-bottom: 10px;
    color: var(--text);
}

#aiProfitLoss .profit-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px dashed #e2e8f0;
}

#aiProfitLoss .profit-row:last-child {
    border-bottom: none;
}

#aiProfitLoss .profit-row .profit-label {
    color: var(--text-secondary);
}

#aiProfitLoss .profit-row .profit-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.profit-value.positive {
    color: var(--success);
}

.profit-value.negative {
    color: var(--danger);
}

/* AI Mode Info */
.ai-mode-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.ai-capability-tag {
    background: #e0e7ff;
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Emergency active state */
.status-badge.emergency {
    background: #fee2e2;
    color: #dc2626;
    animation: pulse-emergency 2s infinite;
}

@keyframes pulse-emergency {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* Approval level tags */
.approval-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.approval-tag.auto {
    background: #d1fae5;
    color: #059669;
}

.approval-tag.manager {
    background: #fef3c7;
    color: #d97706;
}

.approval-tag.boss {
    background: #fee2e2;
    color: #dc2626;
}

/* Action buttons row for emergency */
.ai-emergency-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text);
    transition: all var(--transition);
}

.ai-emergency-btn:hover {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}

/* Responsive sub-nav for AI - 3 columns on small screens */
@media (max-width: 768px) {
    .sub-nav-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .ai-sub-btn {
        padding: 12px 8px;
    }
    .ai-sub-btn .sub-nav-icon {
        font-size: 20px;
    }
    .ai-sub-btn .sub-nav-label {
        font-size: 11px;
    }
}

.sub-content {
    position: relative;
}

.sub-content .panel {
    display: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid var(--border);
}

.sub-content .panel.active {
    display: block;
}

.sub-content .panel-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sub-content .panel-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .nav-btn span:not(.nav-icon) {
        display: none;
    }
    .log-panel {
        display: none;
    }
    .cards-grid {
        grid-template-columns: 1fr;
    }
    .retail-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .retail-charts-grid {
        grid-template-columns: 1fr;
    }
    .local-layout {
        grid-template-columns: 1fr;
    }
    .sub-nav {
        flex-direction: column;
    }

    .miniapp-feature-modal {
        padding: 12px;
    }

    .miniapp-feature-modal-dialog {
        width: 100%;
        height: calc(100vh - 24px);
    }

    .miniapp-feature-modal-header,
    .miniapp-feature-modal-body {
        padding: 16px;
    }

    .miniapp-feature-modal-actions {
        gap: 6px;
    }

    .miniapp-feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .miniapp-feature-modal-restore {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        justify-content: center;
    }
    .sub-nav-btn {
    .sub-nav-btn {
    .sub-nav-btn {
        justify-content: center;
    }
}
