/* ========================================
   闪电下单 · 商家端样式 v2.3
   PC侧边栏 + 平板自适应 + 移动端底部Tab 三布局
   断点：<768 手机 | 768-1023 平板 | ≥1024 PC
   ======================================== */

:root {
    --primary: #FF6B35; --primary-light: #FF8C5A;
    --accent: #FFB800; --success: #00C853; --danger: #FF1744; --info: #448AFF;
    --bg: #F5F3F0; --bg-card: #FFFFFF; --text: #2D2418;
    --text-secondary: #8B7355; --text-muted: #B8A088; --border: #E8E3DC;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 12px rgba(0,0,0,0.06);
    --radius: 12px; --radius-lg: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --sidebar-w: 220px; --header-h: 52px;
    --transition: 0.2s ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg); color: var(--text); min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* ========== 整体布局 ========== */
.merchant-layout { display: flex; min-height: 100dvh; }

/* ========== 侧边栏（PC默认可见） ========== */
.sidebar {
    width: var(--sidebar-w); min-height: 100dvh;
    background: linear-gradient(180deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
    color: #FFF; display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 110;
    overflow-y: auto;
}
.sidebar-brand { padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { font-size: 26px; display: block; margin-bottom: 4px; }
.sidebar-title { font-size: 18px; font-weight: 800; display: block; }
.sidebar-sub { font-size: 11px; color: rgba(255,255,255,0.45); }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 10px; border: none;
    background: transparent; color: rgba(255,255,255,0.65);
    font-size: 14px; cursor: pointer; transition: var(--transition);
    position: relative;
}
.sidebar-item:hover { background: rgba(255,255,255,0.06); color: #FFF; }
.sidebar-item.active { background: rgba(255,107,53,0.25); color: #FFB347; }
.sidebar-icon { font-size: 18px; }
.sidebar-label { flex: 1; text-align: left; font-weight: 500; }
.sidebar-badge {
    font-size: 10px; background: var(--danger); color: #FFF;
    padding: 2px 7px; border-radius: 10px; min-width: 20px; text-align: center;
}
.sidebar-badge:empty { display: none; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.btn-sidebar-link {
    display: block; text-align: center; padding: 8px; border-radius: 8px;
    background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6);
    text-decoration: none; font-size: 12px; transition: var(--transition);
}
.btn-sidebar-link:hover { background: rgba(255,255,255,0.14); color: #FFF; }

/* ========== 移动端 + 平板顶部导航 ========== */
.mobile-header {
    display: none; align-items: center; justify-content: space-between;
    height: var(--header-h); padding: 0 16px; position: sticky; top: 0; z-index: 100;
    background: linear-gradient(135deg, #1A1A2E, #0F3460);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.mobile-header .logo-icon { font-size: 22px; flex-shrink: 0; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.mobile-header .logo-text {
    font-size: 16px; font-weight: 800; color: #FFF; margin: 0;
    flex: 1; min-width: 0; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-spacer { width: 24px; flex-shrink: 0; }
.btn-logout-mobile { flex-shrink: 0; }

/* ========== 移动端 + 平板底部导航 ========== */
.mobile-tabs {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 120;
    background: var(--bg-card); border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}
.mtab {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 7px 0; border: none; background: none;
    cursor: pointer; transition: var(--transition); position: relative;
}
.mtab-icon { font-size: 20px; }
.mtab-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.mtab.active .mtab-label { color: var(--primary); font-weight: 700; }
.mtab-dot { position: absolute; top: 5px; right: calc(50% - 20px); width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.mtab-dot:not(.show) { display: none; }

/* ========== 主内容区 ========== */
.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    padding: 24px; min-height: 100dvh;
}
.mpage { display: none; }
.mpage.active { display: block; }

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
}
.stat-card.orange::before { background: linear-gradient(180deg, #FF6B35, #FFB347); }
.stat-card.blue::before { background: linear-gradient(180deg, #448AFF, #64B5F6); }
.stat-card.red::before { background: linear-gradient(180deg, #FF1744, #FF5252); }
.stat-card.green::before { background: linear-gradient(180deg, #00C853, #69F0AE); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ========== 图表卡片 ========== */
.chart-card, .rank-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-md); margin-bottom: 20px;
}
.chart-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.chart-container { height: 220px; position: relative; }
.chart-container canvas { width: 100%; height: 100%; }

/* ========== 热销排行 ========== */
.rank-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid #F5F2EF;
}
.rank-item:last-child { border-bottom: none; }
.rank-num {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.rank-num.top1 { background: #FFD700; color: #FFF; }
.rank-num.top2 { background: #C0C0C0; color: #FFF; }
.rank-num.top3 { background: #CD7F32; color: #FFF; }
.rank-num.normal { background: #F0EDEA; color: var(--text-secondary); }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sales { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rank-revenue { font-size: 14px; font-weight: 700; color: var(--primary); flex-shrink: 0; }

/* ========== 快捷操作 ========== */
.quick-actions { display: flex; gap: 12px; }
.quick-btn {
    flex: 1; padding: 14px; border-radius: var(--radius); border: none;
    background: var(--bg-card); font-size: 14px; font-weight: 600;
    cursor: pointer; box-shadow: var(--shadow-sm); transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.quick-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.quick-btn:active { transform: scale(0.97); }

/* ========== 订单管理 ========== */
.orders-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.otabs { display: flex; gap: 4px; background: var(--bg-card); border-radius: var(--radius); padding: 4px; box-shadow: var(--shadow-sm); }
.otab {
    padding: 8px 14px; border-radius: 10px; border: none; background: transparent;
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 4px;
}
.otab.active { background: var(--primary); color: #FFF; }
.otab-num { font-size: 10px; background: rgba(255,255,255,0.3); padding: 1px 6px; border-radius: 8px; }
.otoolbar-right { display: flex; align-items: center; gap: 8px; }
.auto-refresh { font-size: 12px; color: var(--success); display: flex; align-items: center; gap: 4px; }
.btn-refresh {
    padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-card); font-size: 16px; cursor: pointer; transition: var(--transition);
}
.order-card-list { display: flex; flex-direction: column; gap: 10px; }

/* ========== 订单卡片 ========== */
.m-order-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 16px 20px; box-shadow: var(--shadow-sm);
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; gap: 16px;
}
.m-order-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.m-order-num { font-size: 15px; font-weight: 700; min-width: 70px; }
.m-order-items { flex: 1; font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.m-order-total { font-size: 18px; font-weight: 800; color: var(--primary); min-width: 80px; text-align: right; }
.m-order-status { padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.m-order-status.pending { background: #FFF3E0; color: #E65100; }
.m-order-status.accepted { background: #E3F2FD; color: #1565C0; }
.m-order-status.completed { background: #E8F5E9; color: #2E7D32; }
.m-order-status.cancelled { background: #FFEBEE; color: #C62828; }
.m-order-time { font-size: 12px; color: var(--text-muted); min-width: 110px; text-align: right; flex-shrink: 0; }

/* ========== 菜品管理表格 ========== */
.menu-mgr-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.menu-mgr-header h3 { font-size: 17px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.menu-mgr-table-wrap { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.menu-mgr-table { width: 100%; border-collapse: collapse; }
.menu-mgr-table th {
    text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
    color: var(--text-muted); background: #FAF9F7; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.menu-mgr-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid #F5F2EF; }
.menu-mgr-table tr:last-child td { border-bottom: none; }
.menu-item-cell { display: flex; align-items: center; gap: 8px; }
.menu-item-cell .emoji { font-size: 24px; flex-shrink: 0; }
.menu-item-cell .name { font-weight: 600; white-space: nowrap; }
.status-tag { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.status-tag.on { background: #E8F5E9; color: #2E7D32; }
.status-tag.off { background: #FFEBEE; color: #C62828; }

/* ========== 设置卡片 ========== */
.settings-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 20px; box-shadow: var(--shadow-md); margin-bottom: 16px;
}
.settings-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #F5F2EF;
    gap: 12px;
}
.setting-row:last-child { border-bottom: none; }
.setting-row > span:first-child { font-size: 14px; flex-shrink: 0; }
.setting-input {
    padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
    font-size: 14px; width: 200px; text-align: right; outline: none;
    background: #fff;
}
.setting-input:focus { border-color: var(--primary); }
.setting-select {
    padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; outline: none;
    background: #fff;
}
.switch-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-shrink: 0; }
.switch-wrap input { display: none; }
.switch-track {
    width: 44px; height: 24px; border-radius: 12px;
    background: #DDD; position: relative; transition: var(--transition);
}
.switch-track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #FFF; transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.switch-wrap input:checked + .switch-track { background: var(--primary); }
.switch-wrap input:checked + .switch-track::after { left: 22px; }
.switch-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    z-index: 300; opacity: 0; pointer-events: none;
    transition: opacity var(--transition); backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-sheet {
    position: fixed; left: 50%; bottom: 50%; transform: translate(-50%, 50%) scale(0.95);
    z-index: 310; background: var(--bg-card); border-radius: var(--radius-lg);
    width: 90%; max-width: 520px; max-height: 80dvh;
    display: flex; flex-direction: column;
    opacity: 0; pointer-events: none; transition: all var(--transition);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-sheet.active { opacity: 1; pointer-events: auto; transform: translate(-50%, 50%) scale(1); }
/* 小于PC宽度时底部弹出 */
@media (max-width: 1023px) {
    .modal-sheet {
        left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: 100%;
        border-radius: 20px 20px 0 0; transform: translateY(100%); max-height: 85dvh;
    }
    .modal-sheet.active { transform: translateY(0); }
}
.modal-handle { width: 36px; height: 4px; background: #DDD; border-radius: 2px; margin: 10px auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0 18px 10px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
.merchant-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-merchant {
    flex: 1; padding: 12px; border-radius: var(--radius); border: none;
    font-size: 14px; font-weight: 700; cursor: pointer; transition: var(--transition);
    min-width: 80px;
}
.btn-merchant:active { transform: scale(0.96); }
.btn-merchant.accept { background: linear-gradient(135deg, #448AFF, #64B5F6); color: #FFF; }
.btn-merchant.complete { background: linear-gradient(135deg, #00C853, #69F0AE); color: #FFF; }
.btn-merchant.print { background: linear-gradient(135deg, #7C4DFF, #B388FF); color: #FFF; }
.btn-merchant.cancel { background: #F0EDEA; color: var(--text-secondary); }

.order-detail-content { flex: 1; overflow-y: auto; padding: 14px 18px; }

/* ========== 打印区 ========== */
.print-zone { display: none; }
@media print {
    body * { visibility: hidden !important; }
    .print-zone, .print-zone * { visibility: visible !important; }
    .print-zone {
        display: block !important; position: absolute; left: 0; top: 0;
        width: 80mm; padding: 3mm; font-size: 11px; color: #000; background: #FFF;
    }
    .print-zone h2 { text-align: center; font-size: 15px; padding-bottom: 2mm; border-bottom: 1px dashed #000; margin-bottom: 2mm; }
    .print-zone .p-row { display: flex; justify-content: space-between; padding: 0.5mm 0; }
    .print-zone .p-div { border-top: 1px dashed #000; margin: 2mm 0; }
    .print-zone .p-total { font-size: 14px; font-weight: 700; text-align: right; }
    .print-zone .p-qr { text-align: center; margin: 2mm 0; font-size: 36px; }
    .print-zone .p-foot { text-align: center; margin-top: 3mm; font-size: 9px; color: #666; }
}

/* ========== Toast ========== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
    z-index: 999; background: rgba(45,36,24,0.88); backdrop-filter: blur(8px);
    color: #FFF; padding: 10px 22px; border-radius: 22px;
    font-size: 13px; font-weight: 600; pointer-events: none;
    opacity: 0; transition: all 0.3s ease; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(0,200,83,0.88); }
.toast.error { background: rgba(255,23,68,0.88); }

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8C5A 40%, #FFB347 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 20px; padding: 40px 32px 32px;
    width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    text-align: center; animation: fadeInUp 0.5s ease;
}
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-form { text-align: left; }
.login-form .form-group { margin-bottom: 16px; }
.login-form .form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.login-form .form-input { width: 100%; padding: 12px 14px; border: 2px solid var(--border); border-radius: 10px; font-size: 15px; outline: none; transition: border var(--transition); }
.login-form .form-input:focus { border-color: var(--primary); }
.login-form .btn-primary-full { margin-top: 8px; }
.login-hint { color: var(--text-muted); font-size: 11px; margin-top: 16px; line-height: 1.8; text-align: center; }

@keyframes shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

/* ========== 退出按钮 ========== */
.logout-link { color: var(--danger) !important; border-color: #FDD !important; margin-top: 4px; cursor: pointer; width: 100%; }
.btn-logout-mobile {
    background: none; border: none; font-size: 18px; cursor: pointer; padding: 4px 8px;
}

/* ========== 菜品管理 - Toggle按钮 ========== */
.btn-toggle-active {
    padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: 1px solid; transition: all 0.2s;
    background: none; white-space: nowrap;
}
.btn-toggle-active[data-active="false"] { color: var(--danger); border-color: #FDD; }
.btn-toggle-active[data-active="true"] { color: var(--success); border-color: #C8E6C9; }
.btn-toggle-active:hover { opacity: 0.8; }

/* ========== 用户管理 ========== */
.btn-add-admin {
    padding: 8px 16px; background: var(--primary); color: #fff; border: none;
    border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.perm-hint {
    background: #F5F3F0; border-radius: 8px; padding: 10px 14px; font-size: 12px;
    color: var(--text-secondary); line-height: 1.6; margin-top: 4px;
}
.btn-delete-admin:hover { background: #FFEBEE !important; }

/* ========== 手机验证弹窗(复用) ========== */
.phone-verify-body { padding: 0 24px 16px; }

/* ========== 弹窗通用 ========== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input { width: 100%; padding: 11px 14px; border: 2px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; transition: border var(--transition); background: #fff; }
.form-input:focus { border-color: var(--primary); }
select.form-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238B7355' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ========== 公共按钮 ========== */
.btn-primary-full {
    display: block; width: 100%; padding: 12px; border: none;
    border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
    background: linear-gradient(135deg, #FF6B35, #FF8C5A); color: #FFF;
    transition: var(--transition);
}
.btn-primary-full:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary-full:active { transform: scale(0.97); }
.btn-secondary-full {
    display: block; flex: 1; padding: 12px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
    background: var(--bg); color: var(--text-secondary); transition: var(--transition);
}
.btn-text {
    background: none; border: none; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 8px;
}

/* ========== 支付配置 ========== */
.payment-hint { color: var(--text-muted); font-size: 12px; margin: -4px 0 16px; line-height: 1.5; }
.payment-section {
    background: var(--bg); border-radius: 12px; padding: 16px; margin-bottom: 12px;
    border: 1px solid var(--border);
}
.payment-section-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
    font-size: 14px; font-weight: 700; color: var(--text);
}
.payment-icon { font-size: 20px; }
.payment-name { flex: 1; font-size: 13px; }
.payment-fields .setting-row { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px 12px; }
.payment-fields .setting-row > span:first-child { min-width: 70px; font-size: 12px; color: var(--text-secondary); padding-top: 8px; }
.payment-fields .setting-input { flex: 1; font-size: 12px; padding: 8px 10px; min-width: 140px; text-align: left; width: auto; }
.setting-textarea {
    flex: 1; padding: 8px 10px; border: 2px solid var(--border); border-radius: 10px;
    font-size: 11px; font-family: 'Courier New', monospace; outline: none;
    transition: border var(--transition); resize: vertical; min-height: 52px; background: #fff;
    min-width: 200px;
}
.setting-textarea:focus { border-color: var(--primary); }

/* ========== 订单详情弹窗内容 ========== */
.detail-header { margin-bottom: 12px; }
.detail-number { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.detail-status { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.detail-status.pending { background: #FFF3E0; color: #E65100; }
.detail-status.accepted { background: #E3F2FD; color: #1565C0; }
.detail-status.completed { background: #E8F5E9; color: #2E7D32; }
.detail-status.cancelled { background: #FFEBEE; color: #C62828; }
.detail-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.detail-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #F5F2EF; font-size: 14px; }
.detail-total { display: flex; justify-content: space-between; padding: 12px 0; font-size: 18px; font-weight: 800; }
.detail-pay { font-size: 13px; color: var(--text-secondary); text-align: right; margin-top: 4px; }
.empty-state { text-align: center; color: var(--text-muted); padding: 48px 0; font-size: 14px; }

/* ========================================
   响应式断点体系
   手机 < 768px  |  平板 768-1023px  |  PC ≥ 1024px
   ======================================== */

/* ── PC 端：≥1024px —— 侧边栏 + 全宽内容 ── */
@media (min-width: 1024px) {
    .mobile-header, .mobile-tabs { display: none !important; }
    .sidebar { display: flex !important; }
    .main-content { margin-left: var(--sidebar-w); padding: 24px 32px; padding-bottom: 32px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .m-order-card { flex-wrap: nowrap; padding: 16px 20px; }
    .modal-sheet {
        left: 50%; right: auto; bottom: 50%; top: auto;
        width: 90%; max-width: 520px;
        border-radius: var(--radius-lg);
        transform: translate(-50%, 50%) scale(0.95);
    }
    .modal-sheet.active { transform: translate(-50%, 50%) scale(1); }
}

/* ── 平板端：768-1023px —— 移动端顶部Header+底部Tab，内容区更宽 ── */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar { display: none !important; width: 0 !important; visibility: hidden !important; pointer-events: none !important; }
    .mobile-header { display: flex; }
    .mobile-tabs { display: flex; padding: 0 40px; }
    .main-content {
        padding: 20px 28px;
        padding-top: calc(var(--header-h) + 16px);
        padding-bottom: calc(64px + var(--safe-bottom) + 16px);
        max-width: 900px; margin: 0 auto !important;
    }
    .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .stat-card { padding: 16px 18px; }
    .stat-value { font-size: 24px; }
    .chart-container { height: 200px; }
    .m-order-card { flex-wrap: nowrap; padding: 14px 16px; gap: 12px; font-size: 13px; }
    .m-order-total { font-size: 16px; min-width: 70px; }
    .m-order-time { min-width: 90px; }
    .orders-toolbar { flex-wrap: nowrap; }
    .menu-mgr-table-wrap { overflow-x: auto; }
    .quick-actions { flex-direction: row; }
    .setting-input { width: 240px; }
    .modal-sheet { max-width: 600px; }
    .payment-fields .setting-row { flex-wrap: nowrap; }
}

/* ── 手机端：<768px —— 紧凑移动布局 ── */
@media (max-width: 767px) {
    .sidebar { display: none !important; width: 0 !important; visibility: hidden !important; pointer-events: none !important; }
    .mobile-header { display: flex; padding: 0 12px; }
    .mobile-tabs { display: flex; }
    .main-content {
        margin-left: 0 !important; padding: 10px;
        padding-top: calc(var(--header-h) + 10px);
        padding-bottom: calc(60px + var(--safe-bottom) + 8px);
    }

    /* 统计卡片 — 2列 */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px 14px; border-radius: var(--radius); }
    .stat-label { font-size: 11px; margin-bottom: 4px; }
    .stat-value { font-size: 20px; }
    .stat-sub { font-size: 10px; }

    /* 图表 */
    .chart-container { height: 180px; }
    .chart-card, .rank-card { padding: 14px; margin-bottom: 12px; }

    /* 热销排行 */
    .rank-item { gap: 8px; padding: 8px 0; }
    .rank-revenue { font-size: 12px; }

    /* 快捷操作 */
    .quick-actions { flex-direction: column; gap: 8px; }
    .quick-btn { font-size: 13px; padding: 12px; }

    /* 订单管理 */
    .orders-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
    .otabs { overflow-x: auto; scrollbar-width: none; width: 100%; -webkit-overflow-scrolling: touch; }
    .otabs::-webkit-scrollbar { display: none; }
    .otab { flex-shrink: 0; white-space: nowrap; font-size: 12px; padding: 7px 11px; }
    .otoolbar-right { justify-content: space-between; }
    .m-order-card { flex-wrap: wrap; gap: 6px 10px; padding: 12px 14px; }
    .m-order-num { min-width: auto; font-size: 13px; }
    .m-order-items { width: 100%; font-size: 12px; order: 3; }
    .m-order-total { font-size: 16px; min-width: auto; order: 2; margin-left: auto; }
    .m-order-status { order: 4; font-size: 11px; }
    .m-order-time { min-width: auto; font-size: 11px; order: 5; width: 100%; text-align: left; }

    /* 菜品管理 — 表格横向滚动 */
    .menu-mgr-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .menu-mgr-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .menu-mgr-table { min-width: 540px; }
    .menu-mgr-table th, .menu-mgr-table td { padding: 10px 12px; font-size: 12px; }

    /* 设置页 — 表单纵向排列 */
    .settings-card { padding: 14px; margin-bottom: 12px; }
    .setting-row { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 0; }
    .setting-row > span:first-child { font-size: 13px; font-weight: 600; }
    .setting-input { width: 100%; text-align: left; padding: 9px 12px; font-size: 15px; }
    .switch-wrap { align-self: flex-start; }
    .setting-select { width: 100%; padding: 9px 12px; font-size: 15px; }

    /* 支付配置 */
    .payment-section { padding: 12px; }
    .payment-section-header { flex-wrap: wrap; }
    .payment-name { font-size: 12px; }
    .payment-fields .setting-row { flex-direction: column; align-items: stretch; }
    .payment-fields .setting-row > span:first-child { padding-top: 0; font-weight: 600; }
    .payment-fields .setting-input { width: 100%; min-width: 0; }
    .setting-textarea { width: 100%; min-width: 0; font-size: 12px; }

    /* 用户管理 */
    .btn-add-admin { width: 100%; text-align: center; }

    /* 弹窗优化 */
    .modal-header h2 { font-size: 15px; }
    .order-detail-content { padding: 10px 14px; }
    .detail-item { font-size: 13px; }
    .detail-total { font-size: 16px; }
    .merchant-actions { flex-direction: column; }
    .btn-merchant { width: 100%; }
    .phone-verify-body { padding: 0 14px 16px; }
}

/* ── 订单卡片：手机端也保持横向flex的修复 ── */
@media (max-width: 480px) {
    .m-order-card {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 10px;
        align-items: center;
    }
    .m-order-num { grid-column: 1; grid-row: 1; }
    .m-order-total { grid-column: 3; grid-row: 1; }
    .m-order-status { grid-column: 1; grid-row: 2; }
    .m-order-items { grid-column: 2 / 4; grid-row: 3; width: 100%; white-space: normal; }
    .m-order-time { grid-column: 2 / 4; grid-row: 2; text-align: left; font-size: 10px; }
}
