/* =========================================================
   七碟子八碗收银台样式表  styles.css
   主题：深墨 appbar + 陶土琥珀主色（承接 /frontend/shared/tokens.css）
   ========================================================= */

:root {
    --color-primary: var(--c-primary, #C05A12);
    --color-primary-dark: var(--c-primary-600, #A04708);
    --color-primary-light: #DE8A3E;
    --color-primary-soft: var(--c-primary-050, #FDF3EA);
    --color-primary-50: #FFFAF3;

    --color-dark: var(--c-ink, #1C1610);
    --color-dark-2: var(--c-ink-soft, #332B20);
    --color-dark-soft: var(--c-muted, #6E6354);

    --color-bg: var(--c-bg, #FAF7F1);
    --color-surface: var(--c-surface, #FFFFFF);
    --color-border: var(--c-line, #E7DFD1);
    --color-border-light: #F1EADD;
    --color-text: var(--c-ink, #1C1610);
    --color-text-secondary: #332B20;
    --color-text-muted: var(--c-faint, #9C907D);

    --color-success: var(--c-success, #157F3D);
    --color-success-soft: var(--c-success-bg, #E9F5EC);
    --color-success-bg: #F2FBF4;

    --color-warning: var(--c-warning, #8F5404);
    --color-warning-soft: var(--c-warning-bg, #FBF0DC);
    --color-warning-bg: #FEF9EE;

    --color-danger: var(--c-danger, #B4291F);
    --color-danger-soft: var(--c-danger-bg, #FAE9E6);
    --color-danger-bg: #FDF3F3;

    --color-info: var(--c-accent, #0F6B63);
    --color-info-soft: var(--c-accent-050, #E3F2F0);

    --color-wechat: var(--pay-wechat, #17A55C);
    --color-alipay: var(--pay-alipay, #3B82C4);
    --color-cash: var(--c-warning, #8F5404);
    --color-card: var(--c-ink-soft, #332B20);

    --shadow-xs: 0 1px 2px rgba(58, 40, 20, 0.05);
    --shadow-sm: var(--shadow-1, 0 1px 2px rgba(11,18,32,.05), 0 1px 3px rgba(11,18,32,.06));
    --shadow-md: var(--shadow-2, 0 4px 14px rgba(11,18,32,.08), 0 1px 3px rgba(11,18,32,.05));
    --shadow-lg: var(--shadow-3, 0 16px 40px rgba(11,18,32,.14), 0 4px 10px rgba(11,18,32,.06));
    --shadow-primary: 0 6px 18px rgba(192, 90, 18, 0.28);
    --shadow-danger: 0 4px 14px rgba(180, 41, 31, 0.22);

    --radius-sm: var(--r-sm, 8px);
    --radius-md: var(--r-md, 12px);
    --radius-lg: var(--r-lg, 16px);
    --radius-xl: var(--r-xl, 24px);
    --radius-pill: var(--r-full, 999px);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 24px;
    --space-8: 32px;

    --header-height: 64px;
    --stats-height: 100px;
    --tables-width: 55%;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    --font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
        Helvetica, Arial, sans-serif);
}

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

html, body { height: 100%; }

body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; outline: none; border: none; background: none; }
svg { display: block; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }
ul { list-style: none; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(28, 22, 16, 0.16); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(28, 22, 16, 0.30); }

/* =========================================================
   与 shared/components.css 的兼容覆盖（模块为权威层）
   ========================================================= */
.btn { height: auto; border: 1px solid transparent; letter-spacing: 0; }
.btn-text, .conn-text { display: inline; }
.modal { width: 100%; background: transparent; border-radius: 0; box-shadow: none; animation: none; overflow: visible; }
.toast {
    position: relative; right: auto; bottom: auto; z-index: auto;
    max-width: none; background: var(--color-surface); color: var(--color-text);
    border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================
   通用按钮
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition),
        transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: var(--radius-md); }

.btn-success {
    background: var(--color-success);
    color: #fff;
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25);
}
.btn-success:hover:not(:disabled) { background: var(--c-primary-600); }

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    box-shadow: var(--shadow-danger);
}
.btn-danger:hover:not(:disabled) { background: var(--c-danger); opacity: .9; }

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover:not(:disabled) { background: var(--color-bg); color: var(--color-text); }

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}
.btn-outline:hover:not(:disabled) { background: var(--color-primary-soft); }

.btn-ghost-danger {
    background: #fff;
    color: var(--color-danger);
    border: 1px solid var(--color-danger-soft);
}
.btn-ghost-danger:hover:not(:disabled) { background: var(--color-danger-bg); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--color-bg); color: var(--color-text); }

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* =========================================================
   登录视图
   ========================================================= */
.login-view {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
}
.login-bg {
    position: fixed;
    inset: 0;
    /* v2.1 统一门面（画布 P1）：暖墨暗景 + 径向琥珀光晕，五端一致 */
    background:
        radial-gradient(circle at 18% 22%, rgba(192, 90, 18, 0.30), transparent 44%),
        radial-gradient(circle at 82% 78%, rgba(58, 40, 20, 0.22), transparent 50%),
        linear-gradient(160deg, #241B10 0%, #17110A 58%, #12100C 100%);
    z-index: -1;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px 32px;
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
    width: 68px; height: 68px;
    margin: 0 auto 14px;
    border-radius: 20px;
    /* v2.1 统一门面：琥珀图标位改淡琥珀底 + 琥珀线性图标（画布 P1） */
    background: var(--c-primary-100);
    color: var(--c-primary);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--glow-soft);
}
.login-title { font-size: 24px; color: var(--color-dark); letter-spacing: 0.5px; }
.login-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); }

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--color-bg);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.input-wrap:focus-within {
    background: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}
.input-icon { margin-left: 14px; color: var(--color-text-muted); flex-shrink: 0; }
.input-wrap:focus-within .input-icon { color: var(--color-primary); }
.input-wrap input { border: none; outline: none; flex: 1; padding: 13px 14px; background: transparent; }
.toggle-pwd { padding: 8px 12px; color: var(--color-text-muted); display: flex; transition: color var(--transition); }
.toggle-pwd:hover { color: var(--color-primary); }

.form-textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-textarea:focus {
    background: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}

/* 开台弹窗等文本输入框 */
.form-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    background: var(--color-bg);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-input:focus {
    background: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}

.login-error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: shake 0.4s;
}
.login-error::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    background: var(--color-danger);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cancel-error {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 6px 0 0;
}
.login-hint span {
    background: var(--color-primary-50);
    color: var(--color-primary-dark);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-weight: 500;
}
.login-footer { margin-top: 28px; font-size: 12px; color: var(--color-text-muted); }

/* =========================================================
   主应用视图
   ========================================================= */
.app-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ---------- 顶部导航（深墨 appbar） ---------- */
.app-header {
    height: var(--header-height);
    flex-shrink: 0;
    background: var(--c-ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 16px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 12px rgba(42, 28, 12, 0.20);
    position: relative;
    z-index: 20;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(192, 90, 18, 0.25);
}
.brand-text {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
}

.conn-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.conn-dot--connected {
    background: var(--color-success);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.22);
    animation: pulse 2s infinite;
}
.conn-dot--connecting {
    background: var(--color-warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    animation: pulse 1s infinite;
}
.conn-dot--disconnected {
    background: var(--color-danger);
    box-shadow: 0 0 0 3px rgba(180, 41, 31, 0.22);
}
/* FE-3：实时降级（仍在轮询兜底，不是断线）——用警示色但不脉冲，避免与"连接中"混淆 */
.conn-dot--degraded {
    background: var(--color-warning);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-center { flex: 1; display: flex; justify-content: center; }
.zone-tabs {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    padding: 4px;
    gap: 2px;
}
.zone-tab {
    padding: 7px 20px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    transition: all var(--transition);
}
.zone-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.zone-tab.active {
    background: var(--c-primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(192, 90, 18, 0.45);
}

.header-right { display: flex; align-items: center; gap: 12px; }
.lan-info {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px 5px 5px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
}
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-primary), var(--color-primary-light));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(192, 90, 18, 0.4);
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 12px; color: rgba(255, 255, 255, 0.6); }

.app-header .icon-btn {
    color: rgba(255, 255, 255, 0.85);
    width: 40px; height: 40px;
}
.app-header .icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ---------- 统计卡片条 ---------- */
.stats-bar {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    padding: 14px 16px 0;
}
.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card__icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card--primary .stat-card__icon { background: var(--color-primary-soft); color: var(--color-primary); }
.stat-card--success .stat-card__icon { background: var(--color-success-soft); color: var(--color-success); }
.stat-card--danger .stat-card__icon { background: var(--color-danger-soft); color: var(--color-danger); }
.stat-card--warning .stat-card__icon { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-card__body { flex: 1; min-width: 0; }
.stat-card__label {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}
.stat-card__value {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-dark);
    line-height: 1;
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
}
.stat-card--primary .stat-card__value { color: var(--color-primary); }
.stat-card--success .stat-card__value { color: var(--color-success); }
.stat-card--danger .stat-card__value { color: var(--color-danger); }
.stat-card--warning .stat-card__value { color: var(--color-warning); }

/* ---------- 主体布局 ---------- */
.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: var(--tables-width) 1fr;
    gap: 16px;
    padding: 16px;
    overflow: hidden;
    min-height: 0;
}

.panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}
.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-title h2 { font-size: 15px; color: var(--color-dark); }
.count-badge {
    min-width: 24px; height: 24px;
    padding: 0 8px;
    border-radius: var(--radius-pill);
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 14px;
}

.refreshing svg { animation: spin 0.8s linear infinite; }

/* =========================================================
   左侧：桌台全视图网格
   ========================================================= */
.panel-tables .panel-body { padding: 12px 16px 16px; }

.tables-zone { margin-bottom: 20px; }
.tables-zone:last-child { margin-bottom: 0; }
.tables-zone__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 10px;
}
.tables-zone__name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-dark);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tables-zone__name::before {
    content: "";
    width: 3px; height: 14px;
    border-radius: 2px;
    background: var(--color-primary);
}
.tables-zone__count { font-size: 12px; color: var(--color-text-muted); }

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    grid-auto-rows: max-content;
}

.table-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}
/* 琥珀左边条：选中/待处理层级指示 */
.table-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: transparent;
    transition: background var(--transition);
}
.table-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.table-card.active {
    border-color: var(--c-line);
    box-shadow: var(--shadow-md);
}
.table-card.active::before { background: var(--c-primary); }
.table-card--available.active,
.table-card--occupied.active,
.table-card--checkout.active {
    background: var(--c-primary-050);
    border-color: rgba(192, 90, 18, 0.35);
}

.table-card--available {
    /* v2.1 状态语言（P4）：中性白卡 + 状态边条 + 徽章，不再整卡染色 */
    background: var(--color-surface);
    border-color: var(--color-border);
}
.table-card--available::before { background: var(--c-accent); }
.table-card--available:hover { border-color: var(--c-accent); }
.table-card--available.active { border-color: rgba(15, 107, 99, 0.38); }

.table-card--occupied {
    background: var(--color-surface);
    border-color: var(--color-border);
}
.table-card--occupied::before { background: var(--c-warning); }
.table-card--occupied:hover { border-color: var(--c-warning); }
.table-card--occupied.active { border-color: rgba(143, 84, 4, 0.38); }

.table-card--checkout {
    background: var(--color-surface);
    border-color: var(--color-border);
}
.table-card--checkout::before { background: var(--c-primary); }
.table-card--checkout:hover { border-color: var(--c-primary); }
.table-card--checkout.active { border-color: rgba(192, 90, 18, 0.38); animation: none; }

/* RESERVED（已开台）：中性白卡 + 暖沙边条（v2.1 去蓝灰） */
.table-card--reserved {
    background: var(--color-surface);
    border-color: var(--c-line);
}
.table-card--reserved:hover { border-color: var(--color-dark-soft); }
.table-card--reserved.active { background: var(--c-primary-050); border-color: rgba(192, 90, 18, 0.35); }
.table-card--reserved .table-card__no { color: var(--color-text-secondary); }
@keyframes checkoutPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(180, 41, 31, 0.35);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(180, 41, 31, 0);
    }
}

.table-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.table-card__no {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-dark);
    line-height: 1;
    flex: 1;
}
.table-card--available .table-card__no { color: var(--c-accent); }
.table-card--occupied .table-card__no { color: var(--c-warning); }
.table-card--checkout .table-card__no { color: var(--color-danger); }

.table-card__seats {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(0,0,0,0.05);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.table-card__status {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
}
.status-pill--available { background: var(--color-success); color: #fff; }
.status-pill--occupied { background: var(--color-warning); color: #fff; }
.status-pill--checkout { background: var(--color-danger); color: #fff; }
.status-pill--reserved { background: var(--color-dark-soft); color: #fff; }

.table-card__body {
    min-height: 52px;
    display: flex;
    align-items: center;
    min-width: 0;
}
.table-card__empty {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
    padding: 8px 0;
}
.table-card__order {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.table-card__amount {
    font-size: 18px;
    font-weight: 800;
    color: var(--color-dark);
    line-height: 1;
}
.table-card--checkout .table-card__amount { color: var(--color-danger); }
.table-card__meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--color-text-secondary);
    flex-wrap: nowrap;
    min-width: 0;
}
.table-card__items { font-weight: 600; flex-shrink: 0; }
.table-card__dot { color: var(--color-text-muted); flex-shrink: 0; }
/* 单号是不可断长 token：必须允许收缩并省略，否则会撑破卡体被硬裁切 */
.table-card__orderno {
    color: var(--color-text-muted);
    font-family: ui-monospace, monospace;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 桌台骨架屏 */
.tables-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.skeleton-table-card {
    height: 110px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* =========================================================
   右侧：详情 / 待结账
   ========================================================= */
.panel-detail { overflow: hidden; }

.detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border-light);
    padding: 0 16px;
    flex-shrink: 0;
    background: var(--color-surface);
}
.detail-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 13px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
    position: relative;
}
.detail-tab:hover { color: var(--color-primary); }
.detail-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.detail-tab__badge {
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--color-danger);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.detail-tab-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.detail-tab-panel.active { display: flex; }

/* ========= 右侧：订单详情 ========= */
.detail-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-muted);
}
.detail-empty .empty-icon {
    width: 88px; height: 88px;
    margin-bottom: 18px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.detail-empty h3 {
    font-size: 17px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}
.detail-empty p { font-size: 13px; max-width: 300px; }

.detail-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--color-primary-50), #fff);
}
.detail-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.detail-table-info { display: flex; align-items: center; gap: 14px; }
.detail-table-num {
    width: 54px; height: 54px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(192, 90, 18, 0.32);
}
.detail-titles h3 { font-size: 17px; color: var(--color-dark); margin-bottom: 3px; }
.detail-titles .detail-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.detail-sub .sep { color: var(--color-border); }

.detail-status-wrap { display: flex; align-items: center; gap: 8px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-badge .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.status-PENDING { background: var(--color-warning-soft); color: var(--color-warning); }
.status-PREPARING { background: var(--color-info-soft); color: var(--color-info); }
.status-READY { background: var(--color-success-soft); color: var(--color-success); }
.status-SERVED { background: var(--color-primary-soft); color: var(--color-primary-dark); }
.status-COMPLETED { background: #e5e7eb; color: var(--color-dark-soft); }
.status-CANCELLED { background: var(--color-danger-soft); color: var(--color-danger); }

.detail-items {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
    min-height: 0;
}
.detail-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition);
}
.detail-item:hover { background: var(--color-primary-50); }
.item-name-wrap { min-width: 0; }
.item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.item-remarks {
    margin-top: 3px;
    font-size: 12px;
    color: var(--color-warning);
    display: flex;
    align-items: center;
    gap: 4px;
}
.item-qty {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 600;
    min-width: 48px;
    text-align: center;
}
.item-qty .x { color: var(--color-text-muted); }
.item-price {
    font-size: 13px;
    color: var(--color-text-muted);
    min-width: 70px;
    text-align: right;
}
.item-subtotal {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-dark);
    min-width: 80px;
    text-align: right;
}
.item-status-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.item-status-PENDING { background: var(--color-warning-soft); color: var(--color-warning); }
.item-status-PREPARING { background: var(--color-info-soft); color: var(--color-info); }
.item-status-READY { background: var(--color-success-soft); color: var(--color-success); }
.item-status-SERVED { background: var(--color-primary-soft); color: var(--color-primary-dark); }

.detail-footer {
    border-top: 1px solid var(--color-border-light);
    background: var(--color-surface);
    padding: 16px 22px;
    flex-shrink: 0;
    box-shadow: 0 -4px 16px rgba(31, 41, 55, 0.04);
}
.detail-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.detail-total-label {
    font-size: 13px;
    color: var(--color-text-secondary);
}
.detail-total-label .item-count-text {
    color: var(--color-text-muted);
    font-size: 12px;
    margin-left: 6px;
}
.detail-total-amount {
    font-size: 34px;
    font-weight: 800;
    color: var(--color-primary-dark);
    line-height: 1;
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.detail-total-amount .currency { font-size: 17px; margin-right: 2px; font-weight: 700; }

.detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.detail-actions .btn-block { grid-column: 1 / -1; }

/* ========= 已结账结果 ========= */
.completed-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--color-success-soft);
    color: var(--color-success);
    font-size: 15px;
    font-weight: 600;
}
.completed-banner svg { width: 22px; height: 22px; }
.completed-info {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    font-size: 13px;
    color: var(--color-text-secondary);
    justify-content: center;
}
.completed-info .ci-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.completed-info .ci-label { color: var(--color-text-muted); }

/* ========= 右侧：待结账列表 ========= */
.pending-list-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    overflow-y: auto;
}

.pending-card {
    background: var(--color-surface);
    border: 1.5px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 14px 14px 14px 18px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
/* 斑马线 + 悬浮态：高频扫读列表 */
.pending-card:nth-child(even) { background: var(--c-bg); }
.pending-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--transition);
}
.pending-card:hover {
    border-color: rgba(192, 90, 18, 0.4);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.pending-card:hover::before { background: var(--c-primary); }

.pending-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.pending-card__table { display: flex; align-items: center; gap: 8px; }
.table-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-dark);
    color: #fff;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
}
.table-tag svg { width: 14px; height: 14px; }
.order-type-tag {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
}
.order-type-tag.dine-in { background: var(--color-info-soft); color: var(--color-info); }
.order-type-tag.takeout { background: var(--color-warning-soft); color: var(--color-warning); }

.pending-card__mid {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}
.pending-card__amount {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
}
.pending-card__amount .currency { font-size: 14px; margin-right: 2px; }
.pending-card__meta {
    text-align: right;
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.6;
}
.pending-card__meta .meta-strong { color: var(--color-text-secondary); font-weight: 600; }
.pending-card__time { display: inline-flex; align-items: center; gap: 4px; }

.pending-card__bottom {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-muted);
    gap: 10px;
}
.pending-card__no { font-family: ui-monospace, Menlo, monospace; font-size: 12px; flex: 1; }
.pending-card__checkout {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    transition: background var(--transition), transform var(--transition);
}
.pending-card__checkout:hover { background: var(--color-primary-dark); transform: translateY(-1px); }

/* 空状态 / 列表状态 */
.list-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-muted);
}
.list-state .state-icon {
    width: 64px; height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}
.list-state h4 {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}
.list-state p { font-size: 13px; }

/* =========================================================
   弹窗 Modal
   ========================================================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 22, 16, 0.55);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease;
}
.modal-dialog {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    animation: modalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.modal-dialog--sm { max-width: 480px; }
.modal-dialog--xl { max-width: 880px; width: 100%; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--color-primary-50), transparent);
}
.modal-header h3 {
    font-size: 17px;
    color: var(--color-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: var(--c-surface-2);
}
/* 结账主按钮：全宽突出，收银动线终点 */
#confirmCheckoutBtn { flex: 1; }

/* ========= 结账弹窗 ========= */
.checkout-body {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
    padding: 0;
}
.checkout-left, .checkout-right {
    padding: 20px 22px;
    overflow-y: auto;
    max-height: calc(92vh - 140px);
}
.checkout-left {
    border-right: 1px solid var(--color-border-light);
    background: var(--c-bg);
}

.checkout-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--color-border);
    width: 100%;
}

.checkout-items { display: flex; flex-direction: column; }
.checkout-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--color-border-light);
}
.checkout-item:last-child { border-bottom: none; }
.checkout-item__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-dark);
    min-width: 0;
}
.checkout-item__remark {
    margin-top: 3px;
    font-size: 12px;
    color: var(--color-warning);
    font-weight: 500;
}
.checkout-item__qty {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 600;
    min-width: 44px;
    text-align: center;
}
.checkout-item__price {
    font-size: 12px;
    color: var(--color-text-muted);
    min-width: 64px;
    text-align: right;
}
.checkout-item__subtotal {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-dark);
    min-width: 72px;
    text-align: right;
}

/* ========= 金额结算框 ========= */
.amount-box {
    background: var(--color-primary-50);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--color-primary-soft);
}
.amount-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    gap: 10px;
}
.amount-row--input { align-items: flex-start; }
.amount-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-weight: 500;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.amount-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 400;
}
.amount-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-dark);
}

.amount-input-wrap {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    min-width: 110px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.amount-input-wrap:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.currency-prefix {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-right: 4px;
}
.amount-input-wrap input {
    flex: 1;
    padding: 8px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary-dark);
    text-align: right;
    width: 70px;
}
.amount-input-wrap input::-webkit-outer-spin-button,
.amount-input-wrap input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rounding-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.rounding-quick-btn {
    padding: 7px 10px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    transition: all var(--transition);
}
.rounding-quick-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.amount-divider {
    border-top: 1px dashed var(--color-primary-soft);
    margin: 8px 0;
}
.amount-row--final {
    padding-top: 10px;
}
.amount-value--final {
    font-size: 40px;
    font-weight: 800;
    color: var(--color-danger);
    letter-spacing: -0.02em;
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* ========= 支付方式 ========= */
.pay-method-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
    grid-auto-rows: max-content;
}
.pay-method {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 104px;
    padding: 20px 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    transition: all var(--transition);
}
.pay-method input { position: absolute; opacity: 0; pointer-events: none; }
.pay-method:hover {
    border-color: var(--color-primary-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.pay-method.active {
    border-color: var(--c-primary);
    background: var(--c-primary-050);
    box-shadow: 0 0 0 3px rgba(192, 90, 18, 0.14);
}
.pay-method__icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.pay-method--wechat .pay-method__icon { background: var(--color-wechat); }
.pay-method--alipay .pay-method__icon { background: var(--color-alipay); }
.pay-method--cash .pay-method__icon { background: var(--color-cash); }
.pay-method--card .pay-method__icon { background: var(--color-card); }
.pay-method__label { font-size: 14px; font-weight: 700; color: var(--color-dark); }
.pay-method__check {
    position: absolute;
    top: 8px; right: 8px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--c-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}
.pay-method.active .pay-method__check { display: inline-flex; }

/* ========= 取消订单弹窗 ========= */
.cancel-order-info {
    background: var(--color-danger-bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--color-danger-soft);
}
.cancel-order-info__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--color-text-secondary);
}
.cancel-order-info__row strong {
    font-size: 14px;
    color: var(--color-dark);
}

/* =========================================================
   Toast 提示
   ========================================================= */
.toast-container {
    position: fixed;
    top: 84px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 360px;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--color-info);
    pointer-events: auto;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    min-width: 260px;
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }
.toast.info { border-left-color: var(--color-info); }

.toast-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-top: 1px;
}
.toast.success .toast-icon { background: var(--color-success); }
.toast.error .toast-icon { background: var(--color-danger); }
.toast.warning .toast-icon { background: var(--color-warning); }
.toast.info .toast-icon { background: var(--color-info); }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 14px; font-weight: 600; color: var(--color-dark); }
.toast-msg {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-top: 2px;
    word-break: break-word;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* =========================================================
   全局加载遮罩
   ========================================================= */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(28, 22, 16, 0.25);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.spinner {
    width: 44px; height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1280px) {
    :root {
        --tables-width: 52%;
    }
    .tables-grid {
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    }
    .table-card__no { font-size: 19px; }
    .table-card__amount { font-size: 16px; }
}

@media (max-width: 1024px) {
    .app-main {
        grid-template-columns: 1fr;
        /* 2026-11-14 修复：原 auto 1fr 会在桌台卡片很长时把右侧面板压扁——
           页签行贴在桌台卡片下面，点页签切换面板内容完全不可见（用户反馈"点了没效果"）。
           改成两行都按内容高，整页顺滚，页签切换立刻可见。 */
        grid-template-rows: auto auto;
        overflow-y: auto;
        /* Android 手势条/微信 X5 会把网页垫到手势区下面，底部内容（页签行）会被遮住 */
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    :root {
        --tables-width: 100%;
    }
    /* 2026-11-14 平板断点（769-1024px）补齐：
       原先桌台面板 max-height:52vh + overflow hidden 会把桌台卡拦腰裁断；
       待结账列表的 flex:1 + min-height:0 会把卡片压缩到只剩顶条。
       统一改为自然高度、整页滚动（与 ≤768 行为一致），不再有面板内裁切。 */
    .panel-tables {
        max-height: none;
        min-height: 0;
    }
    .panel-detail {
        max-height: none;
    }
    .panel .panel-body {
        flex: none;
        overflow-y: visible;
        max-height: none;
    }
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .checkout-body {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .checkout-left, .checkout-right {
        max-height: none;
        overflow: visible;
    }
    .checkout-left {
        border-right: none;
        border-bottom: 1px solid var(--color-border-light);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: auto;
    }
    .app-header {
        flex-wrap: wrap;
        padding: 10px 14px;
        gap: 10px;
    }
    .header-left { width: 100%; justify-content: space-between; }
    .header-center { order: 3; width: 100%; }
    .header-right { order: 2; }
    .zone-tabs { width: 100%; overflow-x: auto; }
    .zone-tab { padding: 6px 16px; white-space: nowrap; }
    .brand-text { font-size: 18px; }
    .lan-info { display: none; }
    .user-info { display: none; }
    .user-chip { padding: 3px; }

    .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px; }
    .stat-card { padding: 10px 12px; gap: 10px; }
    .stat-card__icon { width: 40px; height: 40px; }
    .stat-card__value { font-size: 18px; }

    .app-main { padding: 10px; gap: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
    .table-card { padding: 10px; }
    .table-card__no { font-size: 18px; }
    .table-card__amount { font-size: 15px; }

    .detail-item {
        padding: 10px 16px;
        gap: 8px;
        grid-template-columns: 1fr auto auto auto;
    }
    .item-price { min-width: 56px; font-size: 12px; }
    .item-subtotal { min-width: 64px; }
    .detail-footer { padding: 14px 16px; }
    .detail-total-amount { font-size: 22px; }

    .pay-method-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .pay-method { padding: 14px 8px; }

    .modal-dialog--xl, .modal-dialog--sm {
        max-height: 94vh;
        border-radius: var(--radius-md);
    }
    .modal { padding: 8px; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; }

    .detail-actions { grid-template-columns: 1fr 1fr; }

    .toast-container {
        top: 14px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    .toast { min-width: 0; }
}

@media (max-width: 480px) {
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .pay-method-grid { grid-template-columns: 1fr 1fr; }
    .detail-item {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "name subtotal"
            "qty price";
        row-gap: 4px;
    }
    .detail-item .item-name-wrap { grid-area: name; }
    .detail-item .item-subtotal { grid-area: subtotal; }
    .detail-item .item-qty { grid-area: qty; text-align: left; min-width: 0; }
    .detail-item .item-price { grid-area: price; text-align: right; }
    .login-card { padding: 32px 22px 24px; }
}

/* =========================================================
   桌台点单（table-order-btn + orderModal）
   ========================================================= */
.table-card__actions {
    display: flex;
    justify-content: center;
    padding-top: 8px;
    border-top: 1px dashed rgba(31, 41, 55, 0.15);
}
.table-order-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 0;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transition: background var(--transition), transform var(--transition);
}
.table-order-btn:hover { background: var(--color-primary-dark); }
.table-order-btn:active { transform: translateY(1px); }

.order-dialog { max-height: 85vh; }

.order-category-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    overflow-x: auto;
    flex-shrink: 0;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-surface);
    scrollbar-width: thin;
}
.order-cat-tab {
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
}
.order-cat-tab:hover { color: var(--color-primary); }
.order-cat-tab.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(192, 90, 18, 0.32);
}

.order-body { padding: 14px 22px 18px; }
.order-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    grid-auto-rows: max-content;
}
.order-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1.5px solid var(--color-border-light);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    min-width: 0;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.order-menu-item:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-sm);
}
.order-menu-item__img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-bg);
    flex-shrink: 0;
}
.order-menu-item__img--ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.order-menu-item__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.order-menu-item__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.order-menu-item__price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-danger);
}
.order-qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}
.order-qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.order-qty-btn--plus { background: var(--color-primary); color: #fff; }
.order-qty-btn:hover:not(:disabled) { transform: scale(1.12); }
.order-qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.order-qty-num {
    min-width: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-dark);
}

.order-footer-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    border-top: 1px solid var(--color-border-light);
    background: var(--c-surface-2);
    flex-shrink: 0;
}
.order-summary {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-dark);
    white-space: nowrap;
}
.order-remark-input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    background: #fff;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.order-remark-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.order-footer-bar .btn { flex-shrink: 0; }

@media (max-width: 768px) {
    .order-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .order-category-tabs { padding: 10px 16px; }
    .order-body { padding: 12px 16px 16px; }
    .order-footer-bar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 16px;
    }
    .order-summary { width: 100%; }
}

@media (max-width: 480px) {
    .order-menu-grid { grid-template-columns: 1fr; }
    .order-summary { width: auto; }
    .order-remark-input { order: 3; width: 100%; flex-basis: 100%; }
}


/* ============================================================
   设计系统升级层 v2 · 暖调编辑式轻奢
   ------------------------------------------------------------
   仅覆盖样式：不改动任何 DOM 结构、类名或 JS 交互钩子。
   依赖 shared/tokens.css 的语义令牌（--c-* / --r-* / --font-* / --ease-*）。
   ============================================================ */

/* ---- 焦点可见性：键盘可达性统一 ---- */
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---- 细滚动条：统一暖色（覆盖模块自身的冷灰滚动条） ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(28, 22, 16, .16);
    border: 2px solid transparent; background-clip: padding-box;
    border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(28, 22, 16, .28); background-clip: padding-box; }

/* ---- 金额 / 计数：等宽数字，纵向对齐 ---- */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---- 品牌与容器 ---- */
.login-card { border-radius: var(--r-xl); box-shadow: var(--shadow-3); }
.login-title { font-family: var(--font-display); font-weight: 600; letter-spacing: var(--tracking-tight); }

/* ---- 面板 / 统计卡：暖阴影 + 顶部发丝高光 ---- */
.panel { box-shadow: var(--shadow-1), var(--hairline); }
.stat-card {
    box-shadow: var(--shadow-1), var(--hairline);
    transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.stat-card:hover { box-shadow: var(--glow-soft); transform: translateY(-2px); }
.table-card { box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .7); }
.table-card:hover { box-shadow: var(--glow-soft); }
.modal-dialog { border-radius: var(--r-xl); }
.pay-method {
    transition: border-color var(--dur) var(--ease-out),
                background-color var(--dur) var(--ease-out),
                box-shadow var(--dur) var(--ease-out);
}
.pay-method:hover { border-color: var(--c-primary-100); box-shadow: var(--shadow-1); }

/* =========================================================
   整页：桌台详情视图（点击桌台全屏切换）
   ========================================================= */
.table-detail-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    animation: tdpIn 0.24s var(--ease-out, ease-out);
}
@keyframes tdpIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* ---- 顶栏 ---- */
.tdp-header {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 22px;
    background: linear-gradient(180deg, var(--color-primary-50, #FFFAF3), var(--color-surface, #fff));
    border-bottom: 1px solid var(--color-border-light, #F1EADD);
    flex-shrink: 0;
}
.tdp-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border, #E7DFD1);
    background: var(--color-surface, #fff);
    color: var(--color-text-secondary, #332B20);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition);
    flex-shrink: 0;
}
.tdp-back:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}
.tdp-header-title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex-wrap: wrap;
}
.tdp-table-chip {
    min-width: 54px;
    height: 54px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 4px 14px rgba(192, 90, 18, 0.32);
    flex-shrink: 0;
}
.tdp-titles h2 {
    font-size: 21px;
    color: var(--color-dark, #1C1610);
    display: flex;
    align-items: center;
    gap: 10px;
}
.tdp-zone {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary-dark);
    background: var(--color-primary-soft);
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    letter-spacing: 1px;
}
.tdp-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 3px;
}
.tdp-sub .sep { color: var(--color-border); }

/* ---- 主体 ---- */
.tdp-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 18px 22px 30px;
}

/* 摘要卡行 */
.tdp-summary {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 12px;
    margin-bottom: 20px;
}
.tdp-summary__card {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-light, #F1EADD);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    padding: 16px 18px;
    min-width: 0;
}
.tdp-summary__card--amount {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.tdp-summary__label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: 7px;
    letter-spacing: 1px;
}
.tdp-summary__value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tdp-summary__value .currency { font-size: 17px; font-weight: 700; margin-right: 2px; }
.tdp-summary__value--sm { font-size: 20px; }
.tdp-summary__value--sm span { font-size: 13px; font-weight: 600; opacity: 0.8; }
.tdp-summary__no { font-size: 14px; word-break: break-all; white-space: normal; }

/* 明细区块 */
.tdp-section-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-dark);
    margin: 2px 0 10px;
}
.tdp-section-title svg { color: var(--color-primary); }

.tdp-items {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border-light, #F1EADD);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    margin-bottom: 8px;
}
.tdp-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 16px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition);
}
.tdp-item:last-child { border-bottom: none; }
.tdp-item:hover { background: var(--color-primary-50, #FFFAF3); }
.tdp-item__name-wrap { min-width: 0; }
.tdp-item__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.tdp-item__qty {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary-dark);
    font-variant-numeric: tabular-nums;
}
.tdp-item__price {
    font-size: 14px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 72px;
    text-align: right;
}
.tdp-item__subtotal {
    font-size: 17px;
    font-weight: 800;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    min-width: 88px;
    text-align: right;
}

/* 操作区（吸底） */
.tdp-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    position: sticky;
    bottom: 0;
    padding: 16px 0 calc(4px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, rgba(246, 244, 240, 0), var(--color-bg, #FAF7F1) 36%);
}
.tdp-actions .btn {
    height: 50px;
    padding: 0 24px;
    font-size: 15px;
    border-radius: var(--radius-md);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.tdp-action--checkout {
    flex: 1;
    min-width: 220px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 4px;
    box-shadow: var(--shadow-primary);
}

/* 空台引导 */
.tdp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 72px 20px 40px;
    color: var(--color-text-muted);
}
.tdp-empty__icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.tdp-empty h3 { font-size: 19px; color: var(--color-text-secondary); margin-bottom: 8px; }
.tdp-empty p { font-size: 13px; max-width: 320px; }
.tdp-order-btn {
    margin-top: 24px;
    height: 54px;
    padding: 0 44px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 2px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-primary);
}

/* 结账成功结果（复用 .detail-empty / .completed-* 既有样式） */

/* 响应式 */
@media (max-width: 1100px) {
    .tdp-summary { grid-template-columns: 1fr 1fr; }
    .tdp-summary__card--amount { grid-column: span 2; }
}
@media (max-width: 640px) {
    .tdp-body { padding: 14px 14px 24px; }
    .tdp-summary { grid-template-columns: 1fr 1fr; gap: 8px; }
    .tdp-summary__card--amount { grid-column: span 2; }
    .tdp-summary__value { font-size: 26px; }
    .tdp-item { grid-template-columns: 1fr auto auto; }
    .tdp-item__price { display: none; }
    .tdp-actions .btn { padding: 0 16px; font-size: 14px; }
    .tdp-action--checkout { min-width: 160px; }
}

/* ===================== 单品上菜/退菜（第五批） ===================== */
.tdp-item { grid-template-columns: 1fr auto auto auto auto; }
.tdp-item--refunded { opacity: .62; }
.tdp-item--refunded .tdp-item__name { text-decoration: line-through; }
.tdp-item__subtotal.refunded { text-decoration: line-through; color: var(--color-muted); font-weight: 600; }
.tdp-item__refund {
    margin-top: 4px;
    font-size: 12px;
    color: var(--c-danger, #B42318);
    line-height: 1.5;
}
.tdp-item__actions { display: flex; flex-direction: column; gap: 8px; min-width: 92px; }
/* 上菜/退菜按钮加大（2026-11-14 用户反馈太小不好点）：加宽加高、字号上探到 15px */
.tdp-item__btn {
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 700;
    min-width: 84px;
    border-radius: 10px;
    border: 1px solid var(--color-border, #E3D9C8);
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
    white-space: nowrap;
}
.tdp-item__btn:hover:not(:disabled) { transform: translateY(-1px); }
.tdp-item__btn:disabled { opacity: .5; cursor: not-allowed; }
.tdp-item__btn--serve {
    border-color: #8FBF98; color: #fff; background: #3E8E4F;
    box-shadow: 0 1px 4px rgba(62, 142, 79, .25);
}
.tdp-item__btn--serve:hover:not(:disabled) { background: #357D44; }
.tdp-item__btn--refund { border-color: #F0C6C0; color: #B42318; background: #FDF4F2; }
.tdp-item__btn--refund:hover:not(:disabled) { background: #FAE7E3; }
.tdp-item__refunded-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-danger, #B42318);
    white-space: nowrap;
}
.tdp-summary__card--refunded { border-color: #F0C6C0; }
.item-status-pill.item-status-CANCELLED { background: #FBEAE7; color: #B42318; }
@media (max-width: 640px) {
    .tdp-item { grid-template-columns: 1fr auto auto; }
    .tdp-item__actions { flex-direction: row; min-width: 0; }
}

/* 结账弹窗/详情面板：退菜提示（第五批补丁） */
.checkout-refund-note {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #FDF4F2;
    border: 1px dashed #F0C6C0;
    color: #B42318;
    font-size: 13px;
    font-weight: 600;
}
.detail-refund-note {
    margin: 0 0 10px;
    padding: 7px 12px;
    border-radius: 8px;
    background: #FDF4F2;
    color: #B42318;
    font-size: 12.5px;
}
.detail-item--refunded { opacity: .55; }
.detail-item--refunded .item-name { text-decoration: line-through; }
.detail-item .item-subtotal.refunded { text-decoration: line-through; color: var(--color-muted); }

/* ---------- 人数选择网格（老年友好，大按钮点选） ---------- */
.guest-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
    margin-bottom: 8px;
}
.guest-btn {
    height: 44px; border: 1px solid var(--c-line); border-radius: var(--r-md);
    background: var(--c-surface); color: var(--c-ink); font-size: 15px; font-weight: 700;
    cursor: pointer; transition: background 120ms var(--ease), border-color 120ms var(--ease), transform 120ms var(--ease);
}
.guest-btn:hover { background: var(--c-surface-2); }
.guest-btn:active { transform: scale(.96); }
.guest-btn.is-selected { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.guest-custom-input { width: 100%; padding: 10px 12px; font-size: 16px; border: 1px solid var(--c-line);
    border-radius: var(--r-md); background: var(--c-bg); color: var(--c-ink); margin-top: 4px; }

/* ===== 2026-11-14 升级层：统计卡直达 / 待上菜列表 / 登录页返回首页 ===== */
/* 可点击的统计卡：待结账、待上菜 → 点击切到右侧对应列表 */
.stat-card--clickable { cursor: pointer; transition: transform 120ms var(--ease), box-shadow 120ms var(--ease); }
.stat-card--clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat-card--clickable:active { transform: translateY(0); }
/* 待上菜卡片复用 pending-card 骨架，尾部加一个"去上菜"引导 */
.serving-card__go {
    font-size: 13px; font-weight: 700; color: var(--c-primary, #C05A12);
    background: #FDF1E6; border: 1px solid #F0DCC3; border-radius: 999px;
    padding: 4px 12px; white-space: nowrap;
}
/* 登录页返回首页链接 */
.login-home-link { color: var(--c-muted, #8A7B63); text-decoration: none; font-size: 13px; }
.login-home-link:hover { color: var(--c-primary, #C05A12); text-decoration: underline; }

/* ===== 2026-11-14 升级层：返回首页按钮 ===== */
a.icon-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.icon-btn.icon-btn--home { flex: none; }
.login-home-link { color: var(--c-muted, #8A7B63); text-decoration: none; font-size: 13px; }
.login-home-link:hover { color: var(--c-primary, #C05A12); text-decoration: underline; }

/* ===== 待结账历史未结单折叠区（B1：老单不再刷屏，数据不删） ===== */
.pending-history { margin: 14px 0 4px; border-top: 1px dashed var(--c-line); padding-top: 10px; }
.pending-history > summary {
    cursor: pointer; list-style: none; padding: 10px 12px;
    font-size: 13px; font-weight: 700; color: var(--c-muted, #8A7B63);
    background: var(--c-surface-2, #F5EFE5); border-radius: 10px;
    user-select: none;
}
.pending-history > summary::-webkit-details-marker { display: none; }
.pending-history > summary::before { content: '▸ '; }
.pending-history[open] > summary::before { content: '▾ '; }
.pending-history[open] > summary { margin-bottom: 10px; color: var(--c-ink); }

/* ===== 2026-11-14 移动端信息密度优化（用户反馈：手机上元信息占半屏，有用的内容全在下面） ===== */
/* 原则：手机上压缩「元信息」（品牌行/摘要卡/单号），让桌台卡片、菜品明细、金额进首屏；
   与桌面保持同一份 DOM，只在 ≤768/≤640 断点重排。 */
@media (max-width: 768px) {
    /* 主视图 header：3 行压成 2 行（品牌+连接+图标一行，区域页签一行） */
    .app-header { padding: 8px 12px; gap: 6px; }
    .header-left { width: auto; flex: 1; min-width: 0; }
    .header-right { order: 2; }
    .header-center { order: 3; width: 100%; }
    .brand-text { font-size: 16px; }
    .conn-text { font-size: 11px; }

    /* 统计卡：4 张 2×2 大卡 → 单行横滚薄条（桌面仍是 4 列网格） */
    .stats-bar { display: flex; overflow-x: auto; padding: 8px 10px; gap: 8px; scrollbar-width: none; }
    .stats-bar::-webkit-scrollbar { display: none; }
    .stat-card { flex: 0 0 auto; min-width: 118px; padding: 8px 10px; gap: 8px; }
    .stat-card__icon { width: 34px; height: 34px; }
    .stat-card__icon svg { width: 16px; height: 16px; }
    .stat-card__label { font-size: 11px; white-space: nowrap; }
    .stat-card__value { font-size: 15px; }

    /* 详情页 header：chip/标题/单号行全部收薄 */
    .tdp-header { padding: 10px 14px; gap: 10px; }
    .tdp-back { height: 36px; padding: 0 12px; font-size: 13px; }
    .tdp-table-chip { min-width: 40px; height: 40px; font-size: 15px; padding: 0 10px; }
    .tdp-titles h2 { font-size: 16px; }
    .tdp-sub { font-size: 11px; gap: 6px; }
    .tdp-section-title { font-size: 13px; margin: 12px 0 8px; }
}
@media (max-width: 640px) {
    /* 摘要 4 卡 → 单行薄卡：应收 2fr / 道数 / 状态；单号卡隐藏（页头 tdp-sub 已展示单号） */
    .tdp-summary { grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
    .tdp-summary__card--amount { grid-column: auto; }
    .tdp-summary__card--no { display: none; }
    .tdp-summary__card { padding: 8px 10px; }
    .tdp-summary__value { font-size: 17px; }
    .tdp-summary__value--sm { font-size: 14px; }
    .tdp-summary__label { font-size: 10px; }
    .tdp-body { padding: 12px 12px calc(20px + env(safe-area-inset-bottom, 0px)); }
}

/* ===== 2026-11-14 移动端毛玻璃 + 页签可点性修复（用户反馈） ===== */
@media (max-width: 768px) {
    /* 右侧面板页签行：吸顶毛玻璃条 + 胶囊式选中（原来选中只有橙字+下划线，没背景） */
    .detail-tabs {
        position: sticky;
        top: 6px;
        z-index: 6;
        gap: 6px;
        padding: 6px 10px;
        border-bottom: none;
        border-radius: 14px;
        background: rgba(255, 255, 255, .74);
        backdrop-filter: blur(14px) saturate(1.15);
        -webkit-backdrop-filter: blur(14px) saturate(1.15);
        box-shadow: 0 2px 12px rgba(42, 28, 12, .10);
    }
    .detail-tab {
        border-radius: 999px;
        padding: 8px 12px;
        border-bottom: none;
        background: transparent;
        font-size: 12px;
    }
    .detail-tab.active {
        background: var(--color-primary, #C05A12);
        color: #fff;
        border-bottom-color: transparent;
    }
    .detail-tab__badge { background: rgba(42, 28, 12, .12); color: inherit; }
    .detail-tab.active .detail-tab__badge { background: rgba(255, 255, 255, .28); color: #fff; }

    /* 详情页吸底操作条：透明渐变换成毛玻璃（原来滚动时内容从条里透过来） */
    .tdp-actions {
        margin: 0 -14px;
        padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
        background: rgba(250, 247, 241, .84);
        backdrop-filter: blur(14px) saturate(1.15);
        -webkit-backdrop-filter: blur(14px) saturate(1.15);
        border-top: 1px solid rgba(227, 217, 200, .55);
    }
}

/* ===== 2026-11-14 第二轮移动端重排（用户反馈：详情页上多半屏全是数字站位，菜品看不清） ===== */
/* 原则：手机详情页 = 菜品列表优先。大桌号块、数字摘要卡在手机上一律让位/隐藏，
   应收金额吸底操作条里本来就有，订单状态在页头徽标里，件数并入「菜品明细 · N 道」标题。 */
@media (max-width: 640px) {
    /* 页头：大橙块桌号隐藏（标题已有桌号），整体一行收薄 */
    .tdp-header { padding: 8px 12px; gap: 8px; }
    .tdp-table-chip { display: none; }
    .tdp-back { height: 34px; padding: 0 10px; font-size: 12px; }
    .tdp-titles h2 { font-size: 15px; gap: 6px; }
    .tdp-sub { font-size: 10px; gap: 5px; }
    .tdp-sub .sep { margin: 0; }

    /* 摘要区：只保留「应收总额」一张卡压成一行横条，
       菜品数量/订单状态/订单单号三个数字站位卡全部隐藏 */
    .tdp-summary { display: block; margin: 0 0 8px; }
    .tdp-summary__card { padding: 6px 12px; border-radius: 10px; }
    .tdp-summary__card:not(.tdp-summary__card--amount) { display: none; }
    .tdp-summary__value { font-size: 16px; }
    .tdp-summary__value--sm { font-size: 16px; }
    .tdp-summary__label { font-size: 10px; margin-bottom: 0; }

    /* 菜品行看得清：名称/小计加大，行距收紧 */
    .tdp-item { padding: 10px 2px; }
    .tdp-item__name { font-size: 15px; }
    .tdp-item__subtotal { font-size: 15px; min-width: 70px; }
    .tdp-section-title { margin: 10px 0 6px; }
}

/* ===== 2026-11-14 第三轮：移动端底部导航 + 全屏列表覆盖层 ===== */
/* 用户反馈：三个页签排在页面底部、点了看不到列表——移动端信息架构错误。
   改为：底部固定导航条（毛玻璃）+ 点击弹出全屏列表覆盖层（再点当前项或「收起」关闭）。
   桌面 >768px 完全不受影响。 */
/* 桌面默认隐藏（元素始终在 DOM 中，仅 ≤768px 显示） */
.mobile-tabbar { display: none; }
.detail-tab__close { display: none; }
@media (max-width: 768px) {
    .app-main { grid-template-rows: auto; }

    /* 右侧面板：默认滑出屏幕外，加 .open 全屏覆盖显示 */
    .panel-detail {
        position: fixed;
        left: 0; right: 0; top: 0; bottom: 0;
        z-index: 45;
        transform: translateY(103%);
        transition: transform .26s var(--ease-out, ease-out);
        border-radius: 0;
        box-shadow: 0 -10px 34px rgba(42, 28, 12, .28);
        padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px));
    }
    .panel-detail.open { transform: translateY(0); }

    /* 覆盖层顶部的页签行：吸顶毛玻璃（保留），「收起 ✕」按钮靠右 */
    .detail-tabs { top: 0; border-radius: 0; margin: 0; }
    .detail-tab__close { margin-left: auto; color: var(--color-text-secondary); font-size: 12px; }

    /* 底部导航条：固定 + 毛玻璃，三项 + 徽标 */
    .mobile-tabbar {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 46;
        display: flex;
        gap: 4px;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, .92);
        backdrop-filter: blur(16px) saturate(1.15);
        -webkit-backdrop-filter: blur(16px) saturate(1.15);
        border-top: 1px solid rgba(227, 217, 200, .6);
    }
    .mobile-tabbar button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        padding: 5px 2px;
        font-size: 11px;
        font-weight: 700;
        color: var(--color-text-secondary, #6B5D4D);
        background: none;
        border: none;
        border-radius: 12px;
        cursor: pointer;
    }
    .mobile-tabbar button span { font-size: 15px; line-height: 1.2; }
    .mobile-tabbar button b {
        font-size: 11px;
        min-width: 18px; height: 18px; line-height: 18px;
        border-radius: 999px;
        background: #E8DDCB;
        color: var(--color-dark, #1C1610);
        font-variant-numeric: tabular-nums;
    }
    .mobile-tabbar button.active { color: var(--color-primary, #C05A12); background: #FFF3E8; }
    .mobile-tabbar button.active b { background: var(--color-primary, #C05A12); color: #fff; }
}

/* ===== 2026-11-14 细节：窄屏 header 文字禁止竖排折行 ===== */
@media (max-width: 768px) {
    .brand-text { white-space: nowrap; }
    .conn-status { white-space: nowrap; flex: none; }
    .header-left { gap: 8px; }
}

/* ===== 2026-11-14 防竖排：窄屏下身份/导航类短文本禁止折行（超出显示省略号） ===== */
/* 内容类文本（备注/菜名/描述）仍保留正常换行；此规则只约束 header/徽标/按钮等短 UI 文本 */
@media (max-width: 768px) {
    .brand-text, .brand-sub, .brand-name, .role-badge, .user-name, .user-chip,
    .user-chip-name, .user-chip-role, .user-avatar, .conn-text, .conn-status,
    .sub-title, .back-btn, .link-btn, .zone-tab, .status-badge, .table-tag,
    .order-type-tag, .detail-tab, .mobile-tabbar button span, .guest-btn, .tc-btn,
    .page-title, .table-badge, .home-link-btn, .header-btn, .menu-refresh-btn,
    .lan-info, .search-wrap input {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 0;
    }
    .sub-title { flex-shrink: 1; min-width: 0; }
}

/* ===== 2026-11-14 header 装箱修复（上一轮 nowrap 引入的挤压问题） ===== */
/* 原则：品牌名可收缩省略；图标组不收缩；区域页签独立成行；
   详情页打开时区域页签/连接状态隐藏（详情页用不到区域筛选） */
@media (max-width: 768px) {
    .header-left { flex: 1 1 auto; min-width: 0; }
    .header-brand { min-width: 0; overflow: hidden; }
    /* 覆盖防竖排块对 .brand-text 的 flex-shrink:0（不可收缩会让 header 装箱混乱） */
    .brand-text {
        flex-shrink: 1;
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .header-right { order: 2; flex-shrink: 0; margin-left: auto; }
    .header-center { order: 3; width: 100%; }
    body.tdp-open .header-center { display: none; }
    body.tdp-open .conn-status { display: none; }
}
@media (max-width: 480px) {
    .conn-status { display: none; }
}

/* ===== 2026-11-14 桌台网格紧凑化：小卡片、一屏更多桌、不留大片空白 ===== */
@media (max-width: 768px) {
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; }
    .table-card { padding: 7px 8px; }
    .table-card__no { font-size: 15px; }
    .table-card__seats { font-size: 10px; gap: 3px; }
    .table-card__seats svg { width: 10px; height: 10px; }
    .table-card__status { font-size: 10px; padding: 2px 6px; }
    .table-card__body { min-height: 40px; }
    .table-card__amount { font-size: 13px; }
    .table-card__meta { font-size: 10px; }
    /* 单号在窄卡上截断难看：隐藏（详情页/订单视图有完整单号） */
    .table-card__orderno, .table-card__dot { display: none; }
    .table-order-btn, .table-open-btn { padding: 6px 0; font-size: 12px; }
    .tables-zone { margin-bottom: 12px; }
    .tables-zone__header { padding: 6px 2px 6px; font-size: 12px; }
    .tables-zone__count { font-size: 11px; }
}

/* ===== 2026-11-14 统计卡小屏全可见：≤480px 改 2×2 薄卡网格，不再横滚遮挡 ===== */
@media (max-width: 480px) {
    .stats-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; overflow: visible; padding: 8px; }
    .stat-card { min-width: 0; padding: 7px 10px; }
    .stat-card__icon { width: 30px; height: 30px; }
    .stat-card__icon svg { width: 14px; height: 14px; }
    .stat-card__label { font-size: 10px; }
    .stat-card__value { font-size: 14px; }
}

/* ===== 2026-11-14 移动端滚动结构根治：整页滚动，取消固定视口内部滚动 ===== */
/* 问题：app-view 写死 100dvh + app-main 内部 overflow 滚动，多层 flex 高度计算任一环节出错
   （面板限高/ flex:1+min-height:0 / 安全区 padding）就会整体锁死——表现就是"只显示三张台、滑不动"。
   方案：≤1024px 取消固定视口，恢复文档流整页滚动；面板全部自然高度；覆盖层内部仍独立滚动。 */
@media (max-width: 1024px) {
    .app-view {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        overflow: visible;
    }
    .app-main {
        overflow: visible;
        flex: none;
        min-height: 0;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
    .panel, .panel-tables, .panel-detail {
        max-height: none;
        overflow: hidden;   /* 保留圆角裁切，但高度随内容，不会裁内容 */
    }
    .panel .panel-body {
        flex: none;
        min-height: 0;
        max-height: none;
        overflow-y: visible;
    }
}
/* 覆盖层是全屏 fixed 容器，内部必须自己滚（整页滚动管不到它） */
@media (max-width: 768px) {
    .panel-detail.open .panel-body {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* ===== 2026-11-14 顶部统计条与底部导航融合（用户反馈：四个卡与三个导航功能重复） ===== */
/* 手机端：数字归一处、入口归一处
   - 三张可点统计卡（今日订单/待结账/待上菜）与底部导航完全重复 → 整条统计区隐藏
   - 今日营收是底部没有的数字 → 移到 header 右侧小胶囊
   - 底部导航徽标继续显示 订单数/待结账数/待上菜数
   桌面端（>768px）四张统计卡原样保留。 */
.mobile-revenue { display: none; }
@media (max-width: 768px) {
    .stats-bar { display: none; }
    .mobile-revenue {
        display: inline-flex;
        align-items: center;
        height: 28px;
        padding: 0 10px;
        border-radius: 999px;
        font-size: 13px;
        font-weight: 800;
        color: #3E8E4F;
        background: rgba(62, 142, 79, .12);
        border: 1px solid rgba(62, 142, 79, .25);
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }
}

/* ===== 2026-11-14 致命修复：解锁 body 滚动 ===== */
/* 根因：base 样式 body { overflow: hidden }（第 93 行）是为桌面「固定视口 + app-main 内部滚动」
   服务的锁。≤1024 改为整页滚动后，这层锁没解开 —— 内容溢出被裁、滚动条永不出现，
   表现就是"看不到侧边滚动条、无法下滑、只能看到第一屏桌台"。
   桌面（>1024px）保持原状：body 锁定 + app-main 内部滚动。 */
@media (max-width: 1024px) {
    html, body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}
