/* =========================================================
   七碟子八碗餐饮 · 服务员工作台  styles.css
   基于 shared/tokens.css + shared/components.css 的模块样式
   气质：ink 深色 appbar 与结算坞 · 桌台卡片状态色带 · 琥珀主次分明
   平板/手机横屏兼顾（移动优先，≥760px 增强）
   ========================================================= */

:root {
    --st-free: var(--c-success);        /* 空闲 · 绿 */
    --st-open: var(--c-primary);        /* 已开台 · 琥珀 */
    --st-using: var(--c-accent);        /* 在用 · 青 */
    --st-hold: var(--c-faint);          /* 保留/未知 · 灰 */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--c-ink);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; outline: none; }
svg { display: block; }
h1, h2, h3, h4 { font-weight: 700; line-height: var(--lh-tight); }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--c-line); border-radius: var(--r-full); }

/* ---------- 通用按钮（覆盖 shared/.btn：恢复内容高度，加大触控） ---------- */
.btn {
    height: auto;
    padding: 13px 20px;
    border-radius: var(--r-md);
    font-size: 15px; font-weight: 700; line-height: 1;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
                border-color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--c-primary); color: #fff; box-shadow: 0 4px 14px rgba(194, 96, 12, .28); }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-600); }
.btn-ghost { background: var(--c-surface); color: var(--c-ink-soft); border-color: var(--c-line); }
.btn-ghost:hover:not(:disabled) { background: var(--c-surface-2); border-color: var(--c-faint); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { height: auto; padding: 15px 22px; font-size: 16px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--r-sm);
    color: var(--c-muted);
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-ink); }
.btn-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff; border-radius: 50%; animation: spin .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: var(--sp-6); overflow: auto;
}
.login-bg {
    position: fixed; inset: 0; z-index: -1;
    /* 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%);
}
.login-card {
    width: 100%; max-width: 420px;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
    padding: 44px 32px 32px;
    animation: cardIn .5s cubic-bezier(.16, 1, .3, 1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.login-logo { text-align: center; margin-bottom: var(--sp-6); }
.login-logo-icon {
    width: 72px; height: 72px; margin: 0 auto var(--sp-4);
    border-radius: var(--r-lg);
    /* 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: var(--fs-display); color: var(--c-ink); letter-spacing: var(--tracking-tight); font-family: var(--font-display); font-weight: 600; }
.login-subtitle { margin-top: 6px; font-size: var(--fs-cap); color: var(--c-muted); letter-spacing: .22em; text-transform: uppercase; }
.login-form { display: flex; flex-direction: column; gap: var(--sp-5); }
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-group > label {
    font-size: var(--fs-cap); font-weight: 700; color: var(--c-muted);
    letter-spacing: .06em;
}
.input-wrap {
    position: relative; display: flex; align-items: center;
    background: var(--c-bg);
    border: 1.5px solid transparent; border-radius: var(--r-md);
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.input-wrap:focus-within { background: var(--c-surface); border-color: var(--c-primary); box-shadow: var(--shadow-focus); }
.input-icon { margin-left: 14px; color: var(--c-faint); flex-shrink: 0; }
.input-wrap:focus-within .input-icon { color: var(--c-primary); }
.input-wrap input { flex: 1; min-width: 0; padding: 15px 14px; background: transparent; border: none; outline: none; font-size: 16px; color: var(--c-ink); }
.input-wrap input::placeholder { color: var(--c-faint); }
.toggle-pwd { padding: 10px 14px; color: var(--c-faint); display: flex; transition: color var(--dur-fast) var(--ease); }
.toggle-pwd:hover { color: var(--c-primary); }

.login-error {
    background: var(--c-danger-bg); color: var(--c-danger);
    padding: 12px 14px; border-radius: var(--r-md);
    font-size: 14px; font-weight: 500;
    animation: shake .4s var(--ease);
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.login-footer { margin-top: var(--sp-6); font-size: var(--fs-cap); color: var(--c-faint); letter-spacing: .04em; }

/* =========================================================
   主应用视图 · 深色 ink appbar + 角色徽章
   ========================================================= */
.app-view { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.app-header {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--c-ink) 0%, var(--c-ink-soft) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
    padding: 12px var(--sp-4);
    box-shadow: var(--shadow-2);
    position: relative; z-index: 30;
}
.header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-icon {
    width: 34px; height: 34px; border-radius: var(--r-sm); flex-shrink: 0;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .1);
    color: var(--c-primary);
    display: flex; align-items: center; justify-content: center;
}
.brand-text {
    font-size: 17px; font-weight: 800; letter-spacing: var(--tracking-tight);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.role-badge {
    flex-shrink: 0;
    display: inline-flex; align-items: center;
    height: 24px; padding: 0 12px;
    border-radius: var(--r-full);
    border: 1px solid rgba(194, 96, 12, .55);
    background: rgba(194, 96, 12, .16);
    color: #EDBE92;
    font-size: var(--fs-cap); font-weight: 700; letter-spacing: .08em; line-height: 1;
}
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: var(--r-full); background: rgba(255, 255, 255, .08); }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(150deg, var(--c-primary), var(--c-primary-600)); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, .92); }
.app-header .icon-btn { color: rgba(255, 255, 255, .75); width: 40px; height: 40px; }
.app-header .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* 视图容器 */
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ---------- 桌台工具栏 ---------- */
.toolbar {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
    padding: var(--sp-4) var(--sp-4) var(--sp-2);
}
.toolbar-title { font-size: var(--fs-h2); font-weight: 800; letter-spacing: var(--tracking-tight); color: var(--c-ink); display: flex; align-items: center; gap: var(--sp-2); }
.toolbar-title .count-badge {
    min-width: 26px; height: 24px; padding: 0 9px;
    border-radius: var(--r-full);
    background: var(--c-primary-050); color: var(--c-primary-600);
    font-size: 13px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    font-variant-numeric: tabular-nums;
}
.toolbar-right { display: flex; align-items: center; gap: var(--sp-2); }
.select {
    appearance: none; -webkit-appearance: none;
    background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    border: 1px solid var(--c-line); border-radius: var(--r-md);
    padding: 10px 34px 10px 14px;
    font-size: 14px; font-weight: 600; color: var(--c-ink);
    cursor: pointer;
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.select:hover { border-color: var(--c-faint); }
.select:focus { border-color: var(--c-primary); box-shadow: var(--shadow-focus); }
.refreshing svg { animation: spin .8s linear infinite; }

/* 图例 */
.legend {
    flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 6px var(--sp-4);
    padding: 0 var(--sp-4) var(--sp-2);
    font-size: 13px; color: var(--c-muted);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .lg-available { background: var(--st-free); }
.legend .lg-reserved { background: var(--st-open); }
.legend .lg-occupied { background: var(--st-using); }

/* ---------- 桌台卡片网格：顶部 4px 状态色带 + 大号桌号 ---------- */
.tables-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--sp-1) var(--sp-4) var(--sp-6); }
.tables-zone { margin-bottom: var(--sp-5); }
.tables-zone__header { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; }
.tables-zone__name {
    font-size: 15px; font-weight: 800; color: var(--c-ink);
    display: inline-flex; align-items: center; gap: 8px; letter-spacing: var(--tracking-tight);
}
.tables-zone__name::before { content: ""; width: 4px; height: 15px; border-radius: var(--r-full); background: var(--c-primary); }
.tables-zone__count { font-size: 13px; color: var(--c-faint); }
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); grid-auto-rows: max-content; gap: var(--sp-3); }

.table-card {
    position: relative; display: flex; flex-direction: column; gap: 10px;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
    padding: calc(14px + 4px) 14px 12px;
    cursor: pointer; overflow: hidden;
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.table-card::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
    background: var(--st-hold);
}
.table-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.table-card__header { display: flex; align-items: center; gap: var(--sp-2); }
.table-card__no {
    font-size: 30px; font-weight: 800; color: var(--c-ink);
    line-height: 1; flex: 1; letter-spacing: var(--tracking-tight);
    font-variant-numeric: tabular-nums;
}
.table-card__seats {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px; background: var(--c-surface-2);
    border-radius: var(--r-full);
    font-size: 12px; font-weight: 700; color: var(--c-muted);
    font-variant-numeric: tabular-nums;
}
.table-card__status {
    font-size: 12px; font-weight: 800; padding: 4px 10px;
    border-radius: var(--r-full); letter-spacing: .06em; line-height: 1.2;
    color: var(--c-muted); background: var(--c-surface-2);
}

/* 状态色带与徽章（空闲绿 / 已开台琥珀 / 在用青 / 未知灰） */
.table-card--available::before { background: var(--st-free); }
.table-card--available .table-card__status { background: var(--c-success-bg); color: var(--c-success); }
.table-card--reserved::before { background: var(--st-open); }
.table-card--reserved .table-card__status { background: var(--c-primary-050); color: var(--c-primary-600); }
.table-card--occupied::before { background: var(--st-using); }
.table-card--occupied .table-card__status { background: var(--c-accent-050); color: var(--c-accent); }

.table-card__body { min-height: 42px; display: flex; align-items: center; min-width: 0; }
.table-card__empty { flex: 1; text-align: center; font-size: 13px; color: var(--c-faint); font-weight: 600; letter-spacing: .04em; padding: var(--sp-1) 0; }
.table-card__order { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.table-card__amount {
    font-family: var(--font-num);
    font-size: 20px; font-weight: 800; color: var(--c-ink); line-height: 1;
    font-variant-numeric: tabular-nums;
}
.table-card__meta { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--c-muted); flex-wrap: nowrap; font-variant-numeric: tabular-nums; min-width: 0; }
.table-card__meta > span:first-child { flex-shrink: 0; }
/* 单号是不可断长 token：必须允许收缩并省略，否则会撑破卡体被硬裁切 */
.table-card__orderno { color: var(--c-faint); font-family: var(--font-num); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-card__actions { display: flex; gap: var(--sp-2); padding-top: 10px; border-top: 1px dashed var(--c-line); }

/* 操作按钮：主=琥珀 ghost 化，次=中性描边，危险=红调 */
.tc-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 10px 6px; border-radius: var(--r-md);
    font-size: 14px; font-weight: 800; line-height: 1;
    border: 1px solid transparent;
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.tc-btn:active { transform: translateY(1px); }
.tc-btn--primary { background: var(--c-primary-050); color: var(--c-primary-600); border-color: rgba(194, 96, 12, .35); }
.tc-btn--primary:hover { background: #FBE9D7; border-color: var(--c-primary); }
.tc-btn--ghost { background: var(--c-surface); color: var(--c-ink-soft); border-color: var(--c-line); }
.tc-btn--ghost:hover { background: var(--c-surface-2); border-color: var(--c-faint); }
.tc-btn--warn { background: var(--c-surface); color: var(--c-danger); border-color: #EBC9C9; }
.tc-btn--warn:hover { background: var(--c-danger-bg); border-color: var(--c-danger); }

/* 骨架 / 空状态 */
.tables-skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: var(--sp-3); padding: var(--sp-2) 0; }
.skeleton-card {
    height: 140px; border-radius: var(--r-lg);
    /* v2.1：骨架屏温度统一 —— 冷灰蓝改暖沙（shared 骨架同源） */
    background: linear-gradient(90deg, var(--c-surface-2) 25%, #E9E2D4 50%, var(--c-surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s var(--ease) infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.list-state { padding: var(--sp-8) var(--sp-5); text-align: center; color: var(--c-faint); }
.list-state .state-icon {
    width: 64px; height: 64px; margin: 0 auto var(--sp-4);
    border-radius: 50%; background: var(--c-surface-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
}
.list-state h4 { font-size: var(--fs-h3); color: var(--c-ink-soft); margin-bottom: var(--sp-1); }
.list-state p { font-size: 14px; }

/* =========================================================
   子视图顶栏（点菜 / 本桌订单）
   ========================================================= */
.sub-header {
    flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px var(--sp-4);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-line);
}
.back-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 10px 14px; border-radius: var(--r-md);
    background: var(--c-surface-2); color: var(--c-ink-soft);
    font-size: 14px; font-weight: 700;
    transition: background-color var(--dur-fast) var(--ease);
}
.back-btn:hover { background: var(--c-line); }
.sub-title {
    flex: 1; text-align: center;
    font-size: 16px; font-weight: 800; color: var(--c-ink);
    letter-spacing: var(--tracking-tight);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-btn {
    padding: 10px 14px; border-radius: var(--r-md);
    background: var(--c-primary-050); color: var(--c-primary-600);
    font-size: 14px; font-weight: 700; white-space: nowrap;
    transition: background-color var(--dur-fast) var(--ease);
}
.link-btn:hover { background: #FBE9D7; }

/* ---------- 点菜视图：左侧分类竖栏，选中态琥珀左指示条 ---------- */
.order-main { flex: 1; display: flex; min-height: 0; }
.cat-rail {
    width: 96px; flex-shrink: 0; overflow-y: auto;
    background: var(--c-surface);
    border-right: 1px solid var(--c-line);
    display: flex; flex-direction: column;
    padding: var(--sp-2) 0;
}
.cat-item {
    position: relative;
    padding: 16px 8px; text-align: center;
    font-size: 13px; font-weight: 600; color: var(--c-muted);
    border-radius: 0 var(--r-md) var(--r-md) 0; margin-right: var(--sp-2);
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.cat-item .cat-emoji { display: block; font-size: 20px; margin-bottom: 4px; line-height: 1.2; }
.cat-item:hover { background: var(--c-bg); color: var(--c-ink-soft); }
.cat-item.active { background: var(--c-primary-050); color: var(--c-primary-600); font-weight: 800; }
.cat-item.active::before {
    content: ""; position: absolute; left: 0; top: 22%; bottom: 22%;
    width: 3px; border-radius: var(--r-full);
    background: var(--c-primary);
}

.dish-grid {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: var(--sp-3);
    display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    grid-auto-rows: max-content; /* 定高容器下隐式行会被均分压扁，强制按内容高 */
    gap: var(--sp-3); align-content: start;
    background: var(--c-bg);
}
.dish-card {
    display: flex; flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-1);
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.dish-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.dish-media { position: relative; aspect-ratio: 4 / 3; background: var(--c-surface-2); }
.dish-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-media .dish-ph {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 38px;
    background: linear-gradient(135deg, #FBF1E5 0%, #F3EADB 55%, #EDE4D3 100%);
}
.dish-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dish-name { font-size: 14px; font-weight: 700; color: var(--c-ink); line-height: 1.35; letter-spacing: var(--tracking-tight); }
.dish-price {
    font-family: var(--font-num);
    font-size: 16px; font-weight: 800; color: var(--c-primary-600);
    margin-top: auto; font-variant-numeric: tabular-nums;
}
.dish-stepper { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 2px; }
.stepper {
    display: inline-flex; align-items: center;
    border: 1px solid var(--c-line); border-radius: var(--r-full);
    background: var(--c-surface); overflow: hidden;
}
.stepper-btn {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; line-height: 1;
    color: var(--c-ink-soft); background: var(--c-surface-2);
    transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.stepper-btn:hover:not(:disabled) { background: var(--c-primary-050); color: var(--c-primary-600); }
.stepper-btn:disabled { color: var(--c-faint); background: var(--c-bg); cursor: not-allowed; }
.stepper-num {
    min-width: 32px; text-align: center;
    font-size: 15px; font-weight: 800; color: var(--c-ink);
    font-variant-numeric: tabular-nums;
}
.stepper-btn--plus { background: var(--c-primary); color: #fff; }
.stepper-btn--plus:hover:not(:disabled) { background: var(--c-primary-600); color: #fff; }
.stepper-btn--plus:disabled { background: var(--c-line); color: #fff; }

/* ---------- 提交悬浮坞：与点餐页一致的 ink 面板语言 ---------- */
.order-foot {
    flex-shrink: 0; display: flex; align-items: center; gap: var(--sp-3);
    margin: 0 var(--sp-3) calc(var(--sp-3) + env(safe-area-inset-bottom));
    padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
    background: linear-gradient(180deg, #221A11 0%, var(--c-ink) 100%);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, .06);
    border-top: none;
}
.cart-chip {
    position: relative; display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: 11px 16px; border-radius: var(--r-full);
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .88);
    font-size: 14px; font-weight: 700;
    transition: background-color var(--dur-fast) var(--ease);
}
.cart-chip:hover { background: rgba(255, 255, 255, .14); }
.cart-chip .chip-badge {
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: var(--r-full);
    background: var(--c-primary); color: #fff;
    font-size: 13px; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
    font-variant-numeric: tabular-nums;
}
.order-total {
    flex: 1; text-align: right;
    font-family: var(--font-num);
    font-size: 24px; font-weight: 800; color: #fff; line-height: 1;
    font-variant-numeric: tabular-nums;
}
.order-total .cur { font-size: 14px; color: rgba(255, 255, 255, .55); margin-right: 2px; }
.submit { padding: 15px 26px; font-size: 16px; border-radius: var(--r-md); box-shadow: 0 6px 18px rgba(194, 96, 12, .4); }
.submit:disabled { box-shadow: none; }

/* ---------- 已选清单抽屉 ---------- */
.sheet { position: fixed; inset: 0; z-index: 120; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(28, 22, 16, .5); backdrop-filter: blur(2px); animation: fadeIn .2s var(--ease); }
.sheet-panel {
    position: relative; width: 100%; max-width: 760px;
    background: var(--c-surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 82vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-3);
    animation: sheetIn .3s cubic-bezier(.16, 1, .3, 1);
}
@keyframes sheetIn { from { transform: translateY(32px); opacity: .6; } }
@keyframes fadeIn { from { opacity: 0; } }
.sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--c-line);
}
.sheet-head h3 { font-size: var(--fs-h2); font-weight: 800; color: var(--c-ink); letter-spacing: var(--tracking-tight); }
.cart-list { flex: 1; overflow-y: auto; padding: var(--sp-1) var(--sp-5); }
.cart-line { display: flex; flex-direction: column; gap: var(--sp-2); padding: 14px 0; border-bottom: 1px dashed var(--c-line); }
.cart-line:last-child { border-bottom: none; }
.cart-line__top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.cart-line__name { font-size: 15px; font-weight: 700; color: var(--c-ink); }
.cart-line__sub {
    font-size: 15px; font-weight: 800; color: var(--c-primary-600); white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.cart-line__ctrl { display: flex; align-items: center; gap: 10px; }
.cart-line__price { font-size: 13px; color: var(--c-faint); font-variant-numeric: tabular-nums; }
.cart-line__ctrl .stepper-btn { width: 40px; height: 40px; }
.cart-line__ctrl .stepper-num { min-width: 40px; font-size: 16px; }
.item-remark {
    width: 100%; padding: 11px 12px;
    background: var(--c-bg); border: 1.5px solid transparent;
    border-radius: var(--r-md); font-size: 14px; color: var(--c-ink);
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.item-remark::placeholder { color: var(--c-faint); }
.item-remark:focus { background: var(--c-surface); border-color: var(--c-primary); box-shadow: var(--shadow-focus); }
.sheet-remark { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--c-line); }
.sheet-remark label { display: block; font-size: var(--fs-cap); font-weight: 700; color: var(--c-muted); letter-spacing: .06em; margin-bottom: var(--sp-2); }
.sheet-remark input {
    width: 100%; padding: 12px 14px;
    background: var(--c-bg); border: 1.5px solid transparent;
    border-radius: var(--r-md); font-size: 15px; color: var(--c-ink);
    transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.sheet-remark input:focus { background: var(--c-surface); border-color: var(--c-primary); box-shadow: var(--shadow-focus); }
.sheet-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: var(--sp-4) var(--sp-5) calc(var(--sp-4) + env(safe-area-inset-bottom));
    border-top: 1px solid var(--c-line);
    background: var(--c-surface);
}
.sheet-foot .order-total { color: var(--c-ink); }
.sheet-foot .order-total .cur { color: var(--c-muted); }

/* ---------- 本桌订单视图 ---------- */
.orders-list {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: var(--sp-4);
    display: flex; flex-direction: column; gap: var(--sp-4);
}
.order-card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-1);
}
.order-card__head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: var(--sp-4) var(--sp-4);
    background: var(--c-primary-050);
    border-bottom: 1px solid var(--c-line);
}
.order-card__no {
    font-family: var(--font-num);
    font-size: 14px; font-weight: 800; color: var(--c-ink);
    letter-spacing: 0;
}
.order-card__type { font-size: 12px; color: var(--c-muted); margin-top: 3px; }
.order-card__remark {
    padding: 10px var(--sp-4);
    font-size: 13px; color: var(--c-warning);
    background: var(--c-warning-bg);
    border-bottom: 1px solid var(--c-line);
}
.order-item {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--c-bg);
}
.order-item:last-child { border-bottom: none; }
.order-item__name { font-size: 14px; font-weight: 600; color: var(--c-ink); }
.order-item__remark { margin-top: 3px; font-size: 12px; color: var(--c-warning); }
.order-item__qty { font-size: 14px; color: var(--c-muted); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-item__sub { font-size: 14px; font-weight: 800; color: var(--c-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-card__foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    background: var(--c-bg);
    border-top: 1px solid var(--c-line);
}
.order-card__foot .lbl { font-size: 14px; color: var(--c-muted); font-weight: 600; }
.order-card__foot .amt {
    font-family: var(--font-num);
    font-size: 20px; font-weight: 800; color: var(--c-primary-600);
    font-variant-numeric: tabular-nums;
}

/* 订单状态徽章 */
.status-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px; border-radius: var(--r-full);
    font-size: 12px; font-weight: 700; white-space: nowrap; letter-spacing: .02em;
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-PENDING { background: var(--c-warning-bg); color: var(--c-warning); }
.status-PREPARING { background: var(--c-info-bg); color: var(--c-info); }
.status-READY { background: var(--c-success-bg); color: var(--c-success); }
.status-SERVED { background: var(--c-accent-050); color: var(--c-accent); }
.status-COMPLETED { background: var(--c-surface-2); color: var(--c-muted); }
.status-CANCELLED { background: var(--c-danger-bg); color: var(--c-danger); }

/* =========================================================
   确认弹窗（.modal 覆盖 shared 的面板形态，作全屏遮罩）
   ========================================================= */
.modal {
    position: fixed; inset: 0; z-index: 100;
    width: 100%; max-width: 100%;
    background: transparent; border-radius: 0;
    box-shadow: none; overflow: visible;
    display: flex; align-items: center; justify-content: center;
    padding: var(--sp-5);
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(28, 22, 16, .5); backdrop-filter: blur(3px); animation: fadeIn .2s var(--ease); }
.modal-dialog {
    position: relative;
    background: var(--c-surface);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
    width: 100%; max-width: 420px;
    display: flex; flex-direction: column;
    animation: modalIn .28s cubic-bezier(.16, 1, .3, 1);
    overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(22px) scale(.96); } }
.modal-header { padding: var(--sp-5) var(--sp-5) var(--sp-2); }
.modal-header h3 { font-size: 18px; color: var(--c-ink); letter-spacing: var(--tracking-tight); }
.modal-body { padding: var(--sp-1) var(--sp-5) var(--sp-3); }
.modal-body p { font-size: 15px; color: var(--c-muted); line-height: var(--lh-body); }
.modal-footer {
    padding: var(--sp-4) var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom));
    display: flex; gap: 12px;
}
.modal-footer .btn { flex: 1; padding: 14px; }

/* =========================================================
   Toast（重置 shared/.toast 的固定定位，恢复容器内堆叠）
   ========================================================= */
.toast-container {
    position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
    z-index: 300;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
    width: min(92vw, 400px);
}
.toast {
    position: relative; right: auto; bottom: auto;
    width: 100%; max-width: none;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 16px;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    border-left: 4px solid var(--c-info);
    color: var(--c-ink);
    font-size: 14px; line-height: 1.5;
    pointer-events: auto;
    animation: toastIn .3s cubic-bezier(.16, 1, .3, 1);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast.success { border-left-color: var(--c-success); }
.toast.error { border-left-color: var(--c-danger); }
.toast.warning { border-left-color: var(--c-warning); }
.toast.info { border-left-color: var(--c-info); }
.toast-icon {
    width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 13px; font-weight: 700;
}
.toast.success .toast-icon { background: var(--c-success); }
.toast.error .toast-icon { background: var(--c-danger); }
.toast.warning .toast-icon { background: var(--c-warning); }
.toast.info .toast-icon { background: var(--c-info); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 14px; font-weight: 700; color: var(--c-ink); }
.toast-msg { font-size: 13px; color: var(--c-muted); margin-top: 2px; word-break: break-word; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px); } }

/* ---------- 加载遮罩 ---------- */
.loading-overlay {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(28, 22, 16, .25);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s var(--ease);
}
.spinner {
    width: 44px; height: 44px;
    border: 4px solid rgba(255, 255, 255, .55);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* =========================================================
   平板/桌面（≥760px）：宽屏内容居中，横向兼顾
   ========================================================= */
@media (min-width: 760px) {
    .toolbar, .tables-scroll, .sub-header, .order-main, .order-foot, .orders-list {
        max-width: 860px; margin-left: auto; margin-right: auto; width: 100%;
    }
    .tables-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--sp-4); }
    .dish-grid { grid-template-columns: repeat(auto-fill, minmax(182px, 1fr)); }
    .cat-rail { width: 118px; }
    .cat-item { font-size: 14px; padding: 18px 8px; }
    .order-foot { border-radius: var(--r-lg) var(--r-lg) 0 0; margin-bottom: 0; padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
    .tables-grid { grid-template-columns: repeat(2, 1fr); }
    .dish-grid { grid-template-columns: repeat(2, 1fr); }
    .table-card__no { font-size: 26px; }
}


/* ============================================================
   设计系统升级层 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; }

/* ---- 开台弹窗：人数输入 ---- */
.form-input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    background: var(--c-bg);
    border: 1.5px solid transparent;
    border-radius: var(--r-md);
    font-size: 16px;
    font-weight: 600;
    color: var(--c-ink);
    outline: none;
    transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.form-input:focus {
    background: var(--c-surface);
    border-color: var(--c-primary);
    box-shadow: var(--shadow-focus, 0 0 0 4px rgba(192, 90, 18, .12));
}

/* 已退菜行 */
.order-item--refunded { opacity: .55; }
.order-item--refunded .order-item__name { text-decoration: line-through; }
.order-item__refunded-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 6px;
    background: #FBEAE7;
    color: #B42318;
    font-size: 12px;
    font-weight: 600;
}

/* ---------- 人数选择网格（老年友好，大按钮点选） ---------- */
.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 升级层：返回首页按钮 ===== */
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; }

/* ===== 2026-11-14 升级层：服务员端上菜按钮（本桌订单条目内） ===== */
.order-item__serve-btn {
    flex: none;
    height: 38px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #3E8E4F;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(62, 142, 79, .25);
    transition: background .15s ease, transform .1s ease;
    align-self: center;
}
.order-item__serve-btn:hover { background: #357D44; }
.order-item__serve-btn:active { transform: scale(.96); }

/* ===== 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 收纳：标题省略、用户名隐藏（头像已有首字，不重复） ===== */
@media (max-width: 768px) {
    .app-header { padding: 8px 12px; gap: 8px; }
    .header-brand { flex: 1 1 auto; min-width: 0; overflow: hidden; }
    /* 覆盖防竖排块的 shrink:0——不可收缩会让 header 装箱溢出 */
    .brand-text { flex-shrink: 1; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .user-name { display: none; }
    .user-chip { flex: none; }
    .header-right { flex-shrink: 0; }
    .icon-btn--home, #logoutBtn { flex: none; }
}
