/* ===== 基础 ===== */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    background: #f1f5f9;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
small { font-size: 0.78rem; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    box-shadow: 0 4px 12px -2px rgba(249, 115, 22, 0.4);
}
.btn-primary:hover { box-shadow: 0 6px 16px -2px rgba(249, 115, 22, 0.5); }

.btn-outline {
    background: #fff;
    color: #334155;
    border-color: #cbd5e1;
}
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }

.btn-ghost {
    background: #f1f5f9;
    color: #475569;
}
.btn-ghost:hover { background: #e2e8f0; }

.btn-danger {
    background: #fff;
    color: #dc2626;
    border-color: #fecaca;
}
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }

.btn-sm { padding: 7px 13px; font-size: 0.82rem; border-radius: 7px; }
.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #fff7ed 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 900px;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

.login-panel { padding: 48px 44px; }

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 6px 14px -3px rgba(249, 115, 22, 0.5);
    flex-shrink: 0;
}
.brand-text strong { display: block; font-size: 1.1rem; color: #1e3a5f; line-height: 1.2; }
.brand-text small { color: #64748b; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }

.login-panel h1 { font-size: 1.8rem; color: #0f172a; margin-bottom: 8px; }
.login-sub { color: #64748b; font-size: 0.9rem; margin-bottom: 28px; }

.login-form .field { margin-bottom: 18px; }
.login-hint {
    margin-top: 28px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #64748b;
}
.login-hint strong { display: block; color: #334155; margin-bottom: 6px; font-size: 0.82rem; }
.login-hint code {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 2px 7px;
    border-radius: 5px;
    color: #1e3a5f;
    font-weight: 700;
    margin-right: 4px;
}
.login-hint small { display: block; margin-top: 10px; color: #94a3b8; }

.login-aside {
    background: linear-gradient(160deg, #1e3a5f 0%, #0f172a 100%);
    color: #fff;
    padding: 48px 40px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.login-aside::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.25) 0%, transparent 70%);
    bottom: -100px;
    right: -100px;
}
.login-aside-inner { position: relative; z-index: 1; }
.login-aside h2 { font-size: 1.5rem; margin-bottom: 24px; }
.login-aside ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.login-aside li { display: flex; align-items: center; gap: 12px; color: #cbd5e1; font-size: 0.9rem; }
.login-aside li span {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ===== 后台骨架 ===== */
.admin-shell { display: flex; min-height: 100vh; }

.admin-aside {
    width: 250px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.aside-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}
.aside-brand .brand-text strong { color: #fff; font-size: 1.05rem; }
.aside-brand .brand-text small { color: #64748b; }

.aside-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 14px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.18s;
    position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; }
.nav-item.active {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    box-shadow: 0 6px 14px -4px rgba(249, 115, 22, 0.5);
}
.nav-ico { font-size: 1.1rem; }
.nav-badge {
    margin-left: auto;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 99px;
}

.aside-foot {
    padding: 20px 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.foot-link {
    color: #64748b;
    font-size: 0.85rem;
    padding: 8px 0;
    transition: color 0.15s;
}
.foot-link:hover { color: #e2e8f0; }

.admin-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.content-topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-left h1 { font-size: 1.4rem; color: #0f172a; line-height: 1.2; }
.topbar-sub { font-size: 0.8rem; color: #64748b; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.lang-switch {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.78rem; font-weight: 600;
    background: #f1f5f9; border-radius: 999px; padding: 4px 10px;
}
.lang-switch a { color: #64748b; text-decoration: none; padding: 2px 6px; border-radius: 999px; }
.lang-switch a:hover { color: #0f172a; }
.lang-switch a.active { color: #fff; background: #0f172a; }
.lang-switch .lang-sep { color: #cbd5e1; }

.menu-toggle {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    color: #475569;
}

.content-body { padding: 28px 32px 48px; flex: 1; }

/* ===== 统计卡 ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.12); }
.stat-ico {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-body { min-width: 0; }
.stat-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 4px;
}
.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}
.stat-meta { display: block; font-size: 0.75rem; color: #94a3b8; margin-top: 3px; }

/* ===== 卡片 ===== */
.panel-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    margin-bottom: 24px;
}
.panel-row-top { align-items: start; }

.card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}
.card-grow { flex: 1; }

.card-head {
    padding: 18px 22px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-head h2 { font-size: 1rem; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.78rem; color: #94a3b8; }
.card-body { padding: 22px; }
.card-body-flush { padding: 0; }
.card-foot { padding: 16px 22px; border-top: 1px solid #f1f5f9; }

.count-chip {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.75rem;
    padding: 2px 9px;
    border-radius: 99px;
    font-weight: 700;
}

/* ===== 表格 ===== */
.table-scroll { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 760px;
}
.data-table th {
    text-align: left;
    padding: 13px 16px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table small { color: #94a3b8; font-size: 0.75rem; }

.link-btn {
    color: #f97316;
    font-weight: 700;
    font-size: 0.82rem;
}
.link-btn:hover { text-decoration: underline; }

.empty-hint {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* ===== 状态徽章 ===== */
.pill {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.pill-paid { background: #dcfce7; color: #15803d; }
.pill-pending { background: #fef3c7; color: #a16207; }
.pill-shipped { background: #dbeafe; color: #1d4ed8; }
.pill-cancelled { background: #fee2e2; color: #b91c1c; }

.status-select {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    color: #334155;
}
.status-select:focus { outline: 2px solid #fed7aa; border-color: #f97316; }

/* ===== 筛选栏 ===== */
.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-row input,
.filter-row select {
    padding: 9px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.87rem;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
}
.filter-row input[type="text"] { min-width: 240px; flex: 1; }
.filter-row input:focus,
.filter-row select:focus { outline: 2px solid #fed7aa; border-color: #f97316; }

/* ===== 分页 ===== */
.pager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pager a {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    transition: all 0.15s;
}
.pager a:hover { border-color: #f97316; color: #f97316; }
.pager a.active {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    border-color: transparent;
}

/* ===== 图表 ===== */
.revenue-chart { width: 100%; height: auto; }

/* ===== 排行榜 ===== */
.rank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.rank-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 9px;
}
.rank-num {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.rank-name { flex: 1; font-size: 0.87rem; font-weight: 600; color: #334155; min-width: 0; }
.rank-val { font-size: 0.78rem; color: #64748b; font-weight: 700; white-space: nowrap; }

/* ===== 表单 ===== */
.field { margin-bottom: 18px; flex: 1; min-width: 0; }
.field label {
    display: block;
    font-weight: 700;
    font-size: 0.82rem;
    color: #334155;
    margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
    transition: all 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}
.field small { display: block; margin-top: 5px; color: #94a3b8; font-size: 0.75rem; }

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { margin-bottom: 18px; }

.hint-text {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.5;
}

.form-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 0 8px;
    flex-wrap: wrap;
}

.action-col { display: grid; gap: 10px; margin: 18px 0 12px; }

/* ===== 标签页 ===== */
.tabs-bar {
    display: flex;
    gap: 6px;
    background: #fff;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.87rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.15s;
}
.tab-btn:hover { background: #f1f5f9; color: #334155; }
.tab-btn.active {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    box-shadow: 0 4px 10px -3px rgba(249, 115, 22, 0.45);
}

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

/* ===== 提示 ===== */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 0.88rem;
    border: 1px solid transparent;
}
.alert-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

.test-result {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 9px;
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
    word-break: break-word;
}
.test-result.ok { display: block; background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.test-result.fail { display: block; background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ===== Toast ===== */
.toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #0f172a;
    color: #fff;
    padding: 13px 20px;
    border-radius: 10px;
    font-size: 0.87rem;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    max-width: 340px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: linear-gradient(135deg, #16a34a, #15803d); }
.toast-error { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ===== 详情页 ===== */
.detail-head { margin-bottom: 16px; }
.back-link {
    color: #64748b;
    font-size: 0.87rem;
    font-weight: 600;
}
.back-link:hover { color: #f97316; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.info-grid-3 { grid-template-columns: repeat(3, 1fr); }
.info-item span {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 5px;
}
.info-item strong {
    font-size: 0.95rem;
    color: #0f172a;
    word-break: break-word;
}
.amount-strong { color: #dc2626 !important; font-size: 1.15rem !important; }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 0.82rem !important; }

.info-block {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
}
.info-block span {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 6px;
}
.info-block p { color: #334155; font-size: 0.9rem; line-height: 1.6; }

.raw-data {
    margin-top: 16px;
    padding: 16px;
    background: #0f172a;
    color: #cbd5e1;
    border-radius: 9px;
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 400px;
    font-family: "SF Mono", Consolas, monospace;
    line-height: 1.5;
}

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-row { grid-template-columns: 1fr; }
    .info-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-aside { display: none; }
    .login-panel { padding: 36px 28px; }
}

@media (max-width: 768px) {
    .admin-aside {
        position: fixed;
        left: -260px;
        top: 0;
        z-index: 200;
        transition: left 0.25s ease;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    }
    .admin-aside.open { left: 0; }
    .menu-toggle { display: flex; align-items: center; justify-content: center; }
    .content-topbar { padding: 14px 18px; }
    .content-body { padding: 20px 18px 40px; }
    .stat-grid { grid-template-columns: 1fr; }
    .info-grid, .info-grid-3 { grid-template-columns: 1fr; }
    .field-row { flex-direction: column; gap: 0; }
    .filter-row input[type="text"] { min-width: 100%; }
    .toast-stack { left: 16px; right: 16px; bottom: 16px; }
    .toast { max-width: none; }
}
