/* ============================================================
   餐厅点餐系统 — 全局样式（V4.0 参考截图范式重构）
   主色调：翠绿色 #1abc9c / #16a085（参考截图风格）
   ============================================================ */

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

:root {
    --primary: #1abc9c;
    --primary-dark: #16a085;
    --primary-light: #a8e6cf;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --gray: #95a5a6;
    --light-gray: #ecf0f1;
    --bg: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 10px;
    --radius-lg: 16px;
    --sidebar-width: 82px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   顾客端 V4.0 — 全新 UI（参考截图范式）
   ============================================================ */

/* ---- 顶部绿色标题栏 ---- */
.c-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--primary);
    color: white;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    box-shadow: 0 2px 8px rgba(22,160,133,0.3);
}

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

.c-header-name {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.c-header-reset {
    font-size: 11px;
    background: rgba(255,255,255,0.25);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
}
.c-header-reset:active { background: rgba(255,255,255,0.4); }

.c-header-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.c-header-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: white;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.15s;
    font-size: 20px;
    -webkit-tap-highlight-color: transparent;
}
.c-header-icon:active { background: rgba(255,255,255,0.2); }

/* ---- 次栏：堂食 | 桌号 | 人数 ---- */
.c-subheader {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 99;
    background: white;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--dark);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-bottom: 1px solid #f0f0f0;
}
.c-subheader .sep { color: var(--gray); }
.c-sub-guest-btn {
    color: var(--primary);
    font-weight: 600;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    -webkit-tap-highlight-color: transparent;
}

/* ---- 主体布局：左侧分类 + 右侧内容 ---- */
.c-body {
    display: flex;
    padding-top: 92px; /* header(48) + subheader(~44) 【修复】增加4px避免遮挡第一个分类标题 */
    padding-bottom: 100px; /* cart-bar(56) + bottom-nav(50) */
    min-height: 100vh;
}

/* 左侧分类导航 */
.c-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: #f8f8f8;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-right: 1px solid #eee;
    position: fixed;
    top: 92px; /* 【修复】与 c-body padding-top 保持一致 */
    bottom: 100px; /* above cart+nav */
    left: 0;
    z-index: 90;
}
.c-sidebar::-webkit-scrollbar { display: none; }

.c-cat-item {
    display: block;
    padding: 14px 6px;
    text-align: center;
    font-size: 13px;
    color: var(--gray);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    line-height: 1.3;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.c-cat-item:active { background: #eee; }
.c-cat-item.active {
    background: white;
    color: var(--primary);
    font-weight: 700;
    border-left-color: var(--primary);
}
.c-cat-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    border-radius: 8px;
    padding: 0 4px;
    margin-left: 2px;
    vertical-align: top;
}

/* 右侧菜品列表区 */
.c-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.c-menu-section {
    padding: 10px 12px;
}
.c-menu-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    padding: 8px 4px 10px;
    position: relative;
}
.c-menu-section-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: var(--primary);
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

/* 菜品卡片（参考截图2/4） */
.c-dish {
    display: flex;
    gap: 10px;
    background: white;
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    position: relative;
}
.c-dish-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light-gray);
}
.c-dish-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.c-dish-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    color: #bbb;
}

.c-dish-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}
.c-dish-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.c-dish-sales {
    font-size: 11px;
    color: var(--gray);
    margin-top: 2px;
}
.c-dish-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}
.c-dish-price {
    color: var(--danger);
    font-size: 17px;
    font-weight: 700;
}
.c-dish-price-unit {
    font-size: 12px;
    font-weight: 400;
}

.c-dish-action {
    flex-shrink: 0;
}
/* 选规格按钮（有口味时显示） */
.btn-spec {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 32px;
}
.btn-spec:active { background: var(--primary-light); }
/* 直接加号按钮（无口味时显示） */
.btn-add-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}
.btn-add-circle:active { transform: scale(0.9); }

/* 菜品卡片上的数量控制器（已加购后替换选规格/+按钮） */
.c-dish-qtyctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-qty {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}
.btn-qty-minus {
    background: var(--light-gray);
    color: var(--dark);
}
.btn-qty-plus {
    background: var(--primary);
    color: white;
}
.c-qty-num {
    font-size: 15px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* ---- 底部购物车栏 ---- */
.c-cartbar {
    position: fixed;
    bottom: 50px; /* above bottom nav */
    left: 0;
    right: 0;
    z-index: 98;
    background: white;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}
.c-cart-left {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    padding: 4px 0;
    margin: -4px -8px;
}
.c-cart-icon-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    background: var(--primary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
}
.c-cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}
.c-cart-total-label {
    font-size: 13px;
    color: var(--gray);
}
.c-cart-total-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
}
.c-cart-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
    white-space: nowrap;
}
.c-cart-btn:active { opacity: 0.85; }
.c-cart-btn.disabled {
    opacity: 0.45;
    /* 不用 disabled 属性，微信下事件可能不触发 */
}

/* ---- 底部导航栏 ---- */
.c-navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 97;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 50px;
    box-shadow: 0 -1px 6px rgba(0,0,0,0.06);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid #f0f0f0;
}
.c-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--gray);
    font-size: 10px;
    min-width: 56px;
    -webkit-tap-highlight-color: transparent;
    padding: 4px 0;
}
.c-nav-item.active { color: var(--primary); }
.c-nav-icon {
    font-size: 22px;
    line-height: 1;
}
.c-nav-text {
    font-size: 10px;
    font-weight: 500;
}


/* ============================================================
   弹窗系统（全屏遮罩 + 居中卡片）
   ============================================================ */

.c-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.c-overlay.show { opacity: 1; visibility: visible; }

.c-modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 380px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s;
}
.c-overlay.show .c-modal { transform: scale(1); }

.c-modal-head {
    padding: 16px 18px 12px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid var(--light-gray);
}
.c-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark);
}
.c-modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    font-size: 20px;
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
}
.c-modal-close:active { background: var(--light-gray); }

.c-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
    -webkit-overflow-scrolling: touch;
}
.c-modal-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--light-gray);
    display: flex;
    gap: 10px;
}


/* ============================================================
   弹窗1：人数选择欢迎页（截图1范式）
   ============================================================ */

.welcome-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 300;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.welcome-card {
    background: white;
    border-radius: var(--radius-lg);
    width: 88%;
    max-width: 360px;
    padding: 28px 24px 24px;
    text-align: center;
    animation: welcomeIn 0.35s ease;
}
@keyframes welcomeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.welcome-brand {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.welcome-subtitle {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 24px;
}
.welcome-prompt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--dark);
}
.welcome-table-hint {
    font-size: 13px;
    color: var(--gray);
}
.welcome-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.welcome-num-btn {
    height: 42px;
    border: 1.5px solid #ddd;
    border-radius: 10px;
    background: white;
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.welcome-num-btn:active { border-color: var(--primary); }
.welcome-num-btn.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}
.welcome-num-btn.other {
    grid-column: span 1;
    font-size: 14px;
    color: var(--gray);
}
.welcome-confirm-btn {
    width: 100%;
    height: 46px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 23px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 2px;
}
.welcome-confirm-btn:active { opacity: 0.85; }


/* ============================================================
   弹窗2：门店信息（截图3范式）
   ============================================================ */

.store-info-list {
    list-style: none;
}
.store-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--light-gray);
    font-size: 14px;
}
.store-info-item:last-child { border-bottom: none; }
.store-info-label {
    color: var(--gray);
    flex-shrink: 0;
    margin-right: 12px;
}
.store-info-value {
    color: var(--dark);
    text-align: right;
    word-break: break-all;
}
.store-info-phone-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.store-info-call-btn {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}


/* ============================================================
   弹窗3：选规格/加入购物车（截图4范式）
   ============================================================ */

.spec-dish-header {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}
.spec-dish-thumb {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light-gray);
}
.spec-dish-thumb img { width: 100%; height: 100%; object-fit: cover; }
.spec-dish-meta { flex: 1; }
.spec-dish-name { font-size: 16px; font-weight: 700; color: var(--dark); }
.spec-dish-sales { font-size: 12px; color: var(--gray); margin-top: 2px; }
.spec-dish-price { font-size: 18px; color: var(--danger); font-weight: 700; margin-top: 4px; }

.spec-qty-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.spec-qty-label { font-size: 14px; font-weight: 600; color: var(--dark); }
.spec-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 12px;
}
.spec-qty-ctrl .btn-qty { width: 30px; height: 30px; font-size: 18px; }
.spec-qty-ctrl .c-qty-num { font-size: 17px; }

.spec-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 10px;
}
.spec-taste-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.spec-taste-tag {
    padding: 7px 16px;
    border: 1.5px solid #ddd;
    border-radius: 18px;
    background: white;
    font-size: 13px;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
}
.spec-taste-tag:active { border-color: var(--primary); }
.spec-taste-tag.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.spec-add-btn {
    width: 100%;
    height: 46px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 23px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.spec-add-btn:active { opacity: 0.85; }


/* ============================================================
   弹窗4：确认下单页（截图5范式）—— 改为整页而非弹窗
   ============================================================ */

.confirm-page {
    padding-top: 48px;
    padding-bottom: 70px;
    min-height: 100vh;
    background: var(--bg);
}
.confirm-page .c-header,
.confirm-page .c-subheader,
.confirm-page .c-sidebar,
.confirm-page .c-navbar { display: none !important; }

.confirm-section {
    background: white;
    margin-bottom: 10px;
    padding: 14px 16px;
}
.confirm-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    padding-left: 10px;
    border-left: 3px solid var(--primary);
    margin-bottom: 12px;
}

.confirm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--light-gray);
}
.confirm-item:last-child { border-bottom: none; }
.confirm-item-img {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light-gray);
}
.confirm-item-img img { width: 100%; height: 100%; object-fit: cover; }
.confirm-item-info { flex: 1; min-width: 0; }
.confirm-item-name { font-size: 14px; font-weight: 600; color: var(--dark); }
.confirm-item-qty { font-size: 12px; color: var(--gray); margin-top: 2px; }
.confirm-item-price { font-size: 15px; font-weight: 700; color: var(--dark); flex-shrink: 0; }

.confirm-expand {
    text-align: center;
    padding: 10px;
    color: var(--gray);
    font-size: 13px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.confirm-note-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.confirm-note-label { font-size: 14px; font-weight: 600; color: var(--dark); }
.confirm-note-value {
    font-size: 13px;
    color: var(--danger);
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.confirm-note-arrow { color: #ccc; font-size: 14px; }

.confirm-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    gap: 8px;
    padding: 14px 0 4px;
}
.confirm-total-label { font-size: 14px; color: var(--gray); }
.confirm-total-value { font-size: 22px; font-weight: 700; color: var(--dark); }

.confirm-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: white;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.confirm-bottom-total { text-align: left; }
.confirm-bottom-total-label { font-size: 12px; color: var(--gray); }
.confirm-bottom-total-value { font-size: 20px; font-weight: 700; color: var(--dark); }
.confirm-btn-group { display: flex; gap: 10px; }
.btn-confirm-secondary {
    padding: 10px 20px;
    border: 1.5px solid #ddd;
    background: white;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
}
.btn-confirm-primary {
    padding: 10px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
}
.btn-confirm-primary:active { opacity: 0.85; }


/* ============================================================
   弹窗5：备注（截图6范式）
   ============================================================ */

.note-whole-area {
    margin-bottom: 18px;
}
.note-whole-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
}
.note-whole-input-wrap {
    position: relative;
}
.note-whole-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
}
.note-whole-input:focus { border-color: var(--primary); }
.note-char-count {
    text-align: right;
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
}

.note-item-list { margin-top: 8px; }
.note-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--light-gray);
}
.note-item-row:last-child { border-bottom: none; }
.note-item-name { font-size: 14px; color: var(--dark); }
.note-item-edit-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.note-cancel-btn {
    flex: 1;
    padding: 11px;
    border: 1.5px solid #ddd;
    background: white;
    border-radius: 22px;
    font-size: 15px;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    margin-right: 10px;
}
.note-ok-btn {
    flex: 2;
    padding: 11px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* 【新增】备注内联编辑器（替代原生 prompt） */
.note-inline-editor {
    background: #f8f9fa;
    border: 1.5px solid var(--primary-light);
    border-radius: 10px;
    padding: 12px 14px;
    margin-top: 12px;
}
.note-inline-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 6px;
}
.note-inline-input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    margin-bottom: 8px;
}
.note-inline-input:focus { border-color: var(--primary); }
.note-inline-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.note-inline-cancel {
    padding: 7px 18px;
    border: 1.5px solid #ddd;
    background: white;
    border-radius: 16px;
    font-size: 14px;
    color: var(--dark);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.note-inline-ok {
    padding: 7px 22px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
/* 菜品备注预览文字 */
.note-item-note-preview {
    font-size: 13px;
    color: var(--gray);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ============================================================
   搜索弹窗
   ============================================================ */

.search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 250;
    background: white;
    display: flex;
    flex-direction: column;
}
.search-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
    background: white;
    border-bottom: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.search-input {
    flex: 1;
    height: 36px;
    border: 1.5px solid #ddd;
    border-radius: 18px;
    padding: 0 16px;
    font-size: 15px;
    outline: none;
    background: var(--bg);
}
.search-input:focus { border-color: var(--primary); }
.search-cancel {
    font-size: 15px;
    color: var(--gray);
    border: none;
    background: none;
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
}
.search-empty {
    text-align: center;
    color: var(--gray);
    padding: 60px 20px;
    font-size: 14px;
}


/* ============================================================
   成功页 / 错误页
   ============================================================ */

.success-page, .error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
}

.success-icon { font-size: 64px; margin-bottom: 16px; }
.error-icon { font-size: 64px; margin-bottom: 16px; }

.success-page h2 { color: var(--success); margin-bottom: 8px; font-size: 22px; }
.success-page p { color: var(--gray); margin-bottom: 24px; font-size: 14px; }

.table-name { font-size: 20px; font-weight: bold; color: var(--primary); }

.btn-continue {
    background: var(--primary);
    color: white;
    padding: 12px 36px;
    border-radius: 24px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
}


/* ============================================================
   登录页
   ============================================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 360px;
    text-align: center;
}

.login-card h1 { font-size: 36px; margin-bottom: 4px; }
.login-subtitle { color: var(--gray); margin-bottom: 24px; }

.login-error {
    background: #fee;
    color: var(--danger);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.login-input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--light-gray);
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 16px;
}
.login-input:focus { border-color: var(--primary); outline: none; }

.btn-login {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}
.login-hint { color: var(--gray); font-size: 12px; margin-top: 16px; }


/* ============================================================
   管理后台布局
   ============================================================ */

.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 200px;
    background: var(--dark);
    color: white;
    padding: 20px 0;
    flex-shrink: 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 20px;
    font-weight: bold;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
}
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,0.1); }
.nav-logout { margin-top: 20px; color: rgba(255,255,255,0.5); }

.admin-main {
    flex: 1;
    margin-left: 200px;
    padding: 20px;
    max-width: calc(100vw - 200px);
}

/* 状态栏 */
.status-bar {
    background: white;
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.status-url { background: var(--light-gray); padding: 4px 10px; border-radius: 4px; font-size: 13px; }
.btn-copy { background: none; border: 1px solid var(--gray); border-radius: 4px; padding: 4px 8px; cursor: pointer; font-size: 12px; }
.today-summary { font-size: 14px; color: var(--dark); }
.divider { color: var(--light-gray); margin: 0 8px; }

/* 桌台卡片网格 */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.table-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--gray);
    transition: transform 0.2s;
}
.table-card:hover { transform: translateY(-2px); }
.table-card.status-idle { border-left-color: var(--success); }
.table-card.status-occupied { border-left-color: var(--danger); }
.table-card.status-paused { border-left-color: var(--warning); }
.table-card.status-disabled { border-left-color: var(--dark); }

.table-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.table-card .table-name { font-size: 18px; font-weight: bold; }

.table-status-badge { font-size: 12px; padding: 2px 8px; border-radius: 12px; }
.status-badge-idle { background: #d4edda; color: #155724; }
.status-badge-occupied { background: #f8d7da; color: #721c24; }
.status-badge-paused { background: #fff3cd; color: #856404; }
.status-badge-disabled { background: #e2e3e5; color: #383d41; }

.table-order-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-amount { font-size: 24px; font-weight: bold; color: var(--primary); }
.order-time { color: var(--gray); font-size: 13px; }

.btn-view-order {
    display: block;
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
}
.table-empty { color: var(--gray); text-align: center; padding: 12px 0; }

/* 新订单提示 */
.new-order-alert {
    position: fixed;
    top: 20px; right: 20px;
    background: var(--success);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: bounce 0.5s;
}
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }


/* ============================================================
   页面通用
   ============================================================ */

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 22px; }
.btn-back { color: var(--gray); text-decoration: none; margin-right: 12px; }

.btn-primary {
    background: var(--primary); color: white; border: none;
    padding: 8px 20px; border-radius: 8px; cursor: pointer; font-size: 14px;
    text-decoration: none; display: inline-block;
}
.btn-secondary {
    background: white; color: var(--dark); border: 2px solid var(--light-gray);
    padding: 8px 20px; border-radius: 8px; cursor: pointer; font-size: 14px;
    text-decoration: none; display: inline-block;
}
.btn-danger {
    background: var(--danger); color: white; border: none;
    padding: 8px 20px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn-sm {
    padding: 4px 12px; border: 1px solid var(--light-gray); border-radius: 6px;
    background: white; cursor: pointer; font-size: 13px; text-decoration: none; display: inline-block;
}
.btn-success { background: var(--success); color: white; border: none; }
.btn-warning { background: var(--warning); color: white; border: none; }

/* btn-sm + 颜色变体组合 */
.btn-sm.btn-danger { background: var(--danger); color: white !important; border: none; font-weight: 600; }
.btn-sm.btn-success { background: var(--success); color: white !important; border: none; font-weight: 600; }
.btn-sm.btn-warning { background: var(--warning); color: white !important; border: none; font-weight: 600; }


/* ============================================================
   订单详情
   ============================================================ */

.order-meta {
    background: white; padding: 12px 16px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 16px;
    display: flex; gap: 20px; flex-wrap: wrap; color: var(--gray);
}
.order-note { background: #fff8e1; padding: 4px 12px; border-radius: 6px; color: var(--dark); }
.order-status-badge { padding: 4px 12px; border-radius: 12px; font-size: 13px; }
.status-active { background: #f8d7da; color: #721c24; }
.status-settled { background: #d4edda; color: #155724; }

.order-items-list {
    background: white; border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: hidden; margin-bottom: 16px;
}
.order-item-row {
    padding: 14px 16px; border-bottom: 1px solid var(--light-gray);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.order-item-row:last-child { border-bottom: none; }
.item-cancelled { opacity: 0.5; }
.item-served { background: #f8f9fa; }
.item-main { display: flex; align-items: center; gap: 12px; }
.item-main .item-name { font-weight: 600; }
.item-main .item-qty { color: var(--gray); }
.item-main .item-price { color: var(--primary); font-weight: 600; }
.item-note-detail { font-size: 13px; color: var(--warning); width: 100%; margin-top: 4px; }
.item-actions { display: flex; gap: 8px; align-items: center; }
.status-text-served { color: var(--success); font-size: 13px; }
.status-text-cancelled { color: var(--gray); font-size: 13px; text-decoration: line-through; }

.add-items-section { background: white; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.add-items-section h4 { margin-bottom: 12px; }
.add-items-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.add-item-select { flex: 1; min-width: 200px; padding: 8px; border: 2px solid var(--light-gray); border-radius: 8px; }
.add-qty-input { width: 60px; padding: 8px; border: 2px solid var(--light-gray); border-radius: 8px; text-align: center; }
.btn-add-item { background: var(--success); color: white; border: none; padding: 8px 16px; border-radius: 8px; cursor: pointer; }

.order-bottom-bar {
    position: sticky; bottom: 0; background: white; padding: 16px;
    border-radius: var(--radius); box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    display: flex; justify-content: space-between; align-items: center;
}
.order-bottom-bar.settled { justify-content: center; }
.order-total .total-amount { font-size: 28px; font-weight: bold; color: var(--primary); }
.btn-clear { background: white; border: 2px solid var(--danger); color: var(--danger); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.btn-settle { background: var(--success); color: white; border: none; padding: 10px 28px; border-radius: 8px; cursor: pointer; font-size: 16px; font-weight: bold; }


/* ============================================================
   菜品管理
   ============================================================ */

.menu-cat-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.cat-tab { padding: 8px 18px; border: 2px solid var(--light-gray); background: white; border-radius: 20px; cursor: pointer; white-space: nowrap; font-size: 14px; flex-shrink: 0; }
.cat-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.menu-manage-list { display: flex; flex-direction: column; gap: 8px; }
.menu-manage-item { background: white; border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; }
.mm-image { width: 60px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--light-gray); }
.mm-image img { width: 100%; height: 100%; object-fit: cover; }
.mm-image-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.mm-info { flex: 1; }
.mm-name { font-weight: 600; font-size: 15px; }
.mm-price { color: var(--primary); font-weight: bold; }
.mm-desc { font-size: 12px; color: var(--gray); }
.mm-actions { display: flex; align-items: center; gap: 8px; }
.availability-text { font-size: 12px; color: var(--gray); }

/* 开关 */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray); border-radius: 22px; transition: 0.3s;
}
.toggle-slider:before {
    content: ""; position: absolute; height: 16px; width: 16px;
    left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: var(--success); }
input:checked + .toggle-slider:before { transform: translateX(18px); }


/* ============================================================
   二维码管理
   ============================================================ */

.qr-info-banner { background: #e3f2fd; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.qr-card { background: white; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-align: center; }
.qr-image { width: 160px; height: 160px; margin: 0 auto 12px; border: 1px dashed var(--gray); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.btn-generate { background: none; border: none; color: var(--gray); cursor: pointer; }
.qr-table-name { font-weight: bold; margin-bottom: 4px; }
.qr-url { font-size: 11px; color: var(--gray); word-break: break-all; }
.qr-actions { display: flex; gap: 4px; justify-content: center; margin-top: 8px; }


/* ============================================================
   经营分析
   ============================================================ */

.quick-dates { display: flex; gap: 8px; margin-bottom: 16px; }
.quick-dates a { padding: 6px 16px; border: 2px solid var(--light-gray); border-radius: 20px; text-decoration: none; color: var(--dark); font-size: 13px; }
.quick-dates a:hover { border-color: var(--primary); color: var(--primary); }
.date-input { padding: 6px; border: 2px solid var(--light-gray); border-radius: 6px; }

.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: white; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.stat-label { font-size: 13px; color: var(--gray); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: bold; color: var(--primary); }
.stat-warning { color: var(--warning) !important; }

.analytics-section { background: white; padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.analytics-section h3 { margin-bottom: 16px; }
.analytics-table { width: 100%; border-collapse: collapse; }
.analytics-table th, .analytics-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--light-gray); }
.analytics-table th { color: var(--gray); font-size: 13px; }
.analytics-table .rank { font-weight: bold; color: var(--primary); text-align: center; width: 40px; }
.empty-row { text-align: center !important; color: var(--gray); padding: 24px !important; }

.hourly-bars { display: flex; align-items: flex-end; gap: 4px; height: 200px; padding: 16px 0; overflow-x: auto; }
.hourly-bar { flex: 1; min-width: 30px; background: var(--primary); border-radius: 4px 4px 0 0; position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 4px; transition: opacity 0.2s; }
.hourly-bar:hover { opacity: 0.8; }
.hourly-count { color: white; font-size: 11px; text-align: center; padding: 2px 0; }
.hourly-label { position: absolute; bottom: -20px; width: 100%; text-align: center; font-size: 10px; color: var(--gray); }
.data-actions { display: flex; gap: 8px; }


/* ============================================================
   套餐管理样式
   ============================================================ */

.combo-item { flex-direction: column; align-items: stretch; }
.combo-info { width: 100%; }
.combo-prices { display: flex; gap: 12px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.combo-original { color: var(--gray); text-decoration: line-through; font-size: 13px; }
.combo-discount { color: var(--primary); font-weight: bold; font-size: 18px; }
.combo-save { background: #e8f5e9; color: var(--success); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.combo-contains { font-size: 13px; color: var(--dark); margin: 4px 0; }
.combo-items-select { max-height: 200px; overflow-y: auto; border: 2px solid var(--light-gray); border-radius: 8px; padding: 8px; margin-top: 4px; }
.combo-item-check { display: flex; align-items: center; gap: 6px; padding: 6px 4px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--light-gray); }
.combo-item-check:last-child { border-bottom: none; }
.combo-item-check:hover { background: var(--bg); }
.combo-item-check input { width: auto; }

/* 等候时长高亮 */
.wait-alert { color: var(--danger) !important; font-weight: bold; animation: pulse-warn 1.5s infinite; }
@keyframes pulse-warn { 0%,100%{opacity:1} 50%{opacity:0.6} }
.wait-normal { color: var(--gray); font-size: 12px; }
.table-wait-info { font-size: 12px; margin-top: 4px; }

.sound-toggle-bar {
    background: white; padding: 10px 16px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 16px;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
.sound-toggle-bar label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.sound-toggle-bar input[type=checkbox] { width: auto; }
.wait-threshold-info { font-size: 12px; color: var(--gray); }


/* ============================================================
   首页（欢迎页 + 二维码入口）
   ============================================================ */

.home-page { max-width: 900px; margin: 0 auto; padding: 20px 16px 40px; }
.home-header { text-align: center; padding: 32px 0 24px; }
.home-header h1 { font-size: 32px; color: var(--primary); }
.home-subtitle { color: var(--gray); font-size: 15px; margin-top: 4px; }
.home-admin-entry { text-align: center; margin-bottom: 32px; }
.home-admin-btn {
    display: inline-block; background: var(--dark); color: white;
    padding: 10px 28px; border-radius: 24px; text-decoration: none;
    font-size: 14px; font-weight: 600; transition: opacity 0.2s;
}
.home-admin-btn:hover { opacity: 0.85; }
.home-qr-section { background: white; border-radius: var(--radius); padding: 24px 16px; box-shadow: var(--shadow); }
.home-qr-section h2 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.home-qr-tip { text-align: center; color: var(--gray); font-size: 13px; margin-bottom: 20px; }
.home-qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.home-qr-card {
    display: flex; flex-direction: column; align-items: center; text-decoration: none;
    color: var(--dark); background: var(--bg); border-radius: 10px;
    padding: 12px 8px; transition: transform 0.2s, box-shadow 0.2s;
}
.home-qr-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.home-qr-card img { width: 110px; height: 110px; border-radius: 8px; margin-bottom: 8px; }
.home-qr-name { font-size: 15px; font-weight: 600; }
.home-empty { text-align: center; color: var(--gray); padding: 40px; }
.home-footer { text-align: center; color: var(--gray); font-size: 12px; margin-top: 24px; }


/* ============================================================
   移动端适配（微信内置浏览器优先）
   ============================================================ */

* { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { overflow-x: hidden; -webkit-overflow-scrolling: touch; }

button, .btn-plus, .btn-minus, .guest-btn, .category-tab,
.btn-submit, .btn-sm, .toggle-switch, .nav-item,
.c-header-icon, .c-nav-item, .welcome-num-btn, .btn-spec,
.btn-add-circle, .btn-qty, .c-cart-btn, .spec-taste-tag,
.note-item-edit-btn, .search-cancel {
    min-height: 44px; min-width: 44px;
}

@media (max-width: 768px) {
    /* 管理后台侧边栏 → 顶部横条 */
    .admin-layout { flex-direction: column; }
    .sidebar {
        width: 100% !important; height: auto !important;
        position: fixed; top: 0; left: 0; right: 0; z-index: 500;
        display: flex; flex-direction: row; justify-content: space-between;
        align-items: center; padding: 0 12px;
        background: var(--dark); box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }
    .sidebar-title { display: none; }
    .sidebar nav {
        display: flex; flex-direction: row; gap: 2px; overflow-x: auto;
        -webkit-overflow-scrolling: touch; padding: 8px 0; scrollbar-width: none;
    }
    .sidebar nav::-webkit-scrollbar { display: none; }
    /* 【修复】导航 tab 加大：字体、内边距、图标 */
    .nav-item { padding: 10px 12px !important; text-align: center; font-size: 13px !important; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 3px; line-height: 1.2; min-width: auto; border-radius: 6px; }
    .nav-item.nav-logout { display: none; }
    .admin-main { margin-left: 0 !important; margin-top: 56px; max-width: 100vw !important; padding: 12px !important; padding-bottom: 24px; }

    .page-header { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
    .page-header h2 { font-size: 18px; order: -1; width: 100%; }
    .tables-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .table-card { padding: 12px; }
    .order-amount { font-size: 20px; }
    .stats-cards { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .stat-value { font-size: 18px; }
    .order-meta { flex-direction: column; gap: 6px; font-size: 13px; }
    .order-item-row { padding: 12px 10px; flex-wrap: wrap; gap: 6px; }
    .item-main { width: 100%; gap: 8px; }
    .item-main .item-price { font-size: 16px; }
    .item-actions { width: 100%; justify-content: flex-end; gap: 8px; padding-top: 6px; border-top: 1px dashed var(--light-gray); }

    /* 【修复】订单详情底部按钮：不换行、合理间距 */
    .order-bottom-bar {
        flex-wrap: nowrap !important;
        gap: 8px !important;
        padding: 12px 14px !important;
    }
    .order-bottom-bar .order-total {
        flex-shrink: 0;
    }
    .order-bottom-bar .total-amount {
        font-size: 22px !important;
    }
    .btn-clear {
        padding: 10px 14px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        flex-shrink: 0;
    }
    .btn-settle {
        padding: 10px 18px !important;
        font-size: 15px !important;
        white-space: nowrap !important;
        flex-shrink: 0;
    }

    /* 【修复】菜品管理：弹窗居中（而非页面底部） */
    #itemModal.modal {
        position: fixed !important;
        top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
        display: none !important;
        z-index: 9999;
        background: rgba(0,0,0,0.5);
        align-items: center;
        justify-content: center;
        padding: 20px;
    }
    #itemModal.modal[style*="flex"] {
        display: flex !important;
    }
    .modal-content {
        background: white;
        border-radius: var(--radius-lg);
        padding: 24px 20px;
        width: 100%;
        max-width: 400px;
        max-height: 85vh;
        overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }
    .modal-content h3 {
        font-size: 18px;
        margin-bottom: 16px;
        text-align: center;
    }
    .modal-content label {
        display: block;
        font-size: 14px;
        font-weight: 600;
        color: var(--dark);
        margin-bottom: 4px;
        margin-top: 12px;
    }
    .modal-content input[type="text"],
    .modal-content input[type="number"],
    .modal-content select,
    .modal-content textarea {
        width: 100%;
        padding: 10px 12px;
        border: 1.5px solid #ddd;
        border-radius: 8px;
        font-size: 15px;
        outline: none;
    }
    .modal-content input:focus,
    .modal-content select:focus,
    .modal-content textarea:focus {
        border-color: var(--primary);
    }
    .modal-actions {
        display: flex;
        gap: 10px;
        margin-top: 20px;
    }
    .btn-cancel {
        flex: 1;
        padding: 11px;
        border: 1.5px solid #ddd;
        background: white;
        border-radius: 22px;
        font-size: 15px;
        color: var(--dark);
        cursor: pointer;
    }

    /* 【修复】在售开关：移动端不要被 min-height:44px 撑成球体 */
    .toggle-switch {
        position: relative;
        display: inline-block;
        width: 44px !important;
        height: 24px !important;
        min-height: 24px !important;
        min-width: 44px !important;
        flex-shrink: 0;
    }
    .toggle-slider {
        border-radius: 24px !important;
    }
    .toggle-slider:before {
        width: 18px !important;
        height: 18px !important;
        left: 3px !important;
        bottom: 3px !important;
    }
    input:checked + .toggle-slider:before { transform: translateX(20px) !important; }

    /* 【修复】编辑按钮：确保可点击 */
    .mm-actions .btn-sm {
        min-height: 36px !important;
        min-width: 56px !important;
        padding: 8px 14px !important;
        font-size: 14px !important;
        position: relative;
        z-index: 2;
        cursor: pointer;
        touch-action: manipulation;
    }

    /* 菜品管理列表项：移动端优化 */
    .menu-manage-item {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .mm-image {
        width: 56px !important;
        height: 56px !important;
    }
    .mm-info {
        flex: 1;
        min-width: calc(50% - 30px);
    }
    .mm-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        padding-top: 6px;
        border-top: 1px dashed var(--light-gray);
    }

    /* 分类标签：移动端加大 */
    .cat-tab {
        padding: 10px 20px !important;
        font-size: 15px !important;
    }

    /* 状态栏 URL：移动端换行优化 */
    .status-bar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 6px;
    }
    .status-info {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    .today-summary {
        text-align: center;
    }

    /* 经营分析：数据操作按钮 */
    .data-actions {
        flex-wrap: wrap;
    }
    .data-actions .btn-danger,
    .data-actions .btn-secondary {
        min-height: 40px !important;
        white-space: nowrap;
    }
}

/* 超小屏（iPhone SE 等） */
@media (max-width: 375px) {
    :root { --sidebar-width: 72px; }
    .c-cat-item { font-size: 12px; padding: 12px 4px; }
    .c-dish-img { width: 68px; height: 68px; }
    .c-dish-name { font-size: 14px; }
    .c-dish-price { font-size: 15px; }
    .welcome-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .welcome-num-btn { height: 38px; font-size: 14px; }
}
