/* =========================================================
   七碟子八碗餐饮管理后台 · styles.css
   气质：商务数据大屏 · 深墨侧栏 + 陶土琥珀点缀 · 大留白 · 清晰层级
   依赖：/frontend/shared/tokens.css → /frontend/shared/components.css
   本文件为权威层：对基元仅做“模块形态”收敛，不改语义。
   ========================================================= */

:root {
    --primary:      var(--c-primary);        /* 陶土琥珀 #C05A12 */
    --primary-dark: var(--c-primary-600);
    --primary-tint: var(--c-primary-050);
    --danger:  var(--c-danger);
    --success: var(--c-success);
    --warning: var(--c-warning);
    --text:    var(--c-ink);
    --muted:   var(--c-muted);
    --faint:   var(--c-faint);
    --border:  var(--c-line);
    --bg:      var(--c-bg);
    --surface: var(--c-surface);
    --surface-2: var(--c-surface-2);
    --radius:  var(--r-lg);
    --shadow:      var(--shadow-1);
    --shadow-md:   var(--shadow-2);
    --shadow-hover: var(--shadow-2);
    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
    --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
svg { display: block; }

/* =========================================================
   与 shared/components.css 的兼容覆盖（模块为权威层）
   ========================================================= */
.btn { height: auto; letter-spacing: 0; }
.modal { width: 100%; background: transparent; border-radius: 0; box-shadow: none; animation: none; overflow: visible; }
.toast {
    background: var(--surface); color: var(--text);
    position: relative; right: auto; bottom: auto; z-index: auto;
    max-width: none; border-radius: 14px;
    box-shadow: 0 12px 32px rgba(42, 28, 12, .15);
    animation: toastIn .25s ease;
}

/* =========================================================
   按钮体系
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all .2s;
    white-space: nowrap;
    position: relative;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(192, 90, 18, .26); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary, .btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: none; }
.btn-secondary:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-tint); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(185, 28, 28, .22); }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-outline { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-tint); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid #F1C6C6; }
.btn-danger-outline:hover:not(:disabled) { background: var(--c-danger-bg); }
.btn-warning-outline { background: transparent; color: var(--warning); border: 1px solid #EBD3AD; }
.btn-warning-outline:hover:not(:disabled) { background: var(--c-warning-bg); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 13px 20px; font-size: 15px; }
.btn-block { width: 100%; }

.btn-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    padding: 8px;
    border-radius: 8px;
    color: var(--muted);
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background: var(--primary-tint); color: var(--primary-dark); }
.icon-btn-sm {
    padding: 6px;
    border-radius: 7px;
    color: var(--muted);
    display: inline-flex;
    transition: all .15s;
}
.icon-btn-sm:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm.danger:hover { background: var(--c-danger-bg); color: var(--danger); }

.spinner {
    width: 44px; height: 44px;
    border: 4px solid var(--primary-tint);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* =========================================================
   登录视图
   ========================================================= */
.login-view {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--c-ink);
    position: relative;
    overflow: hidden;
    padding: 20px;
}
.login-bg {
    position: absolute; inset: 0;
    /* v2.1 统一门面：去青绿色相，全暖墨暗景（与画布 P1 一致） */
    background:
        radial-gradient(circle at 22% 18%, rgba(192, 90, 18, .30), transparent 46%),
        radial-gradient(circle at 82% 82%, rgba(58, 40, 20, .22), transparent 52%),
        linear-gradient(160deg, #241B10 0%, #17110A 58%, #12100C 100%);
}
.login-card {
    position: relative;
    background: var(--surface);
    border-radius: 20px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(2, 6, 16, .5);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-700));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 12px 28px rgba(192, 90, 18, .35);
}
.login-title { font-size: 24px; font-weight: 700; color: var(--text); }
.login-subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; letter-spacing: .06em; text-transform: uppercase; }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .02em;
}
.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
    position: absolute;
    left: 12px;
    color: var(--faint);
    pointer-events: none;
}
.input-wrap input {
    width: 100%;
    padding: 11px 12px 11px 40px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: all .2s;
    background: var(--surface-2);
    color: var(--text);
}
.input-wrap input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow-focus);
}
.toggle-pwd {
    position: absolute;
    right: 8px;
    padding: 6px;
    color: var(--muted);
    border-radius: 6px;
}
.toggle-pwd:hover { color: var(--primary); background: var(--primary-tint); }

.login-error, .cancel-error {
    background: var(--c-danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid #F1C6C6;
}
.login-hint { text-align: center; margin-top: 16px; font-size: 12px; color: var(--faint); }
.login-footer { position: relative; margin-top: 24px; color: rgba(255, 255, 255, .55); font-size: 12px; }

/* =========================================================
   主应用布局：深墨侧栏 + 白色工作区
   ========================================================= */
.app-view { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--c-ink);
    color: #C4B6A2;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width .25s ease, transform .25s ease;
    overflow: hidden;
}
.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex-shrink: 0;
}
.sidebar-brand-logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-700));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-brand-text {
    margin-left: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    white-space: nowrap;
}
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 4px;
    color: #A89B85;
    transition: all .15s;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: #F0E8DA; }
.nav-item.active {
    background: rgba(192, 90, 18, .16);
    color: #F3C592;
}
.nav-item.active::before {
    content: "";
    position: absolute;
    left: -12px; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--c-primary);
}
.nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.nav-text { margin-left: 12px; font-size: 14px; font-weight: 500; }
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, .07);
    flex-shrink: 0;
}
.sidebar-footer .nav-item { margin-bottom: 0; }

.app-main-wrap {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 0;          /* 保持内部滚动链 */
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.app-header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
#pageTitle { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.sidebar-toggle {
    padding: 8px;
    border-radius: 8px;
    color: var(--muted);
    display: none;
}
.sidebar-toggle:hover { background: var(--primary-tint); color: var(--primary-dark); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all .15s;
}
.user-chip:hover { background: var(--primary-tint); border-color: #EBCDB0; }
.user-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-700));
    border-radius: 50%;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 600;
}
.user-info-wrap { display: flex; flex-direction: column; line-height: 1.2; }
.user-chip-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-chip-role { font-size: 12px; color: var(--muted); }

.app-main {
    flex: 1;
    min-height: 0;
    padding: 24px;
    overflow-y: auto;
}
.app-main::-webkit-scrollbar { width: 8px; }
.app-main::-webkit-scrollbar-track { background: transparent; }
.app-main::-webkit-scrollbar-thumb { background: #D6C9B4; border-radius: 4px; }
.app-main::-webkit-scrollbar-thumb:hover { background: var(--faint); }

.tab-pane { animation: fadeIn .25s ease; max-width: 1240px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =========================================================
   卡片与区块
   ========================================================= */
.card, .card-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card { margin-bottom: 0; }
.card-section { padding: 20px; transition: box-shadow .2s; }
.card-section:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h3 { font-size: 16px; font-weight: 600; }
.card-header-sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }

.section, .card-section .section-head { }
.section { margin-bottom: 24px; }
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.section-head h3 { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .01em; }
.section-sub { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* =========================================================
   KPI：暖渐变营收主卡 + 白卡大数字
   ========================================================= */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    grid-auto-rows: max-content;
}
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: all .2s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
}
.summary-card.card-orders::before { background: var(--c-accent); }
.summary-card.card-avg::before    { background: var(--c-success); }
.summary-card.card-week::before   { background: var(--c-warning); }
.summary-card.card-month::before  { background: var(--c-warning); }

/* 今日营收主卡：暖渐变，数据大屏第一眼 */
.summary-card.card-main {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-700) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 14px 34px rgba(192, 90, 18, .32);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 4px 24px;
    grid-auto-rows: max-content;
}
.summary-card.card-main::before { display: none; }
.summary-card.card-main::after {
    content: "";
    position: absolute;
    right: -40px; top: -60px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 68%);
    pointer-events: none;
}
.summary-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 10px;
    letter-spacing: .02em;
}
.card-main .summary-label { grid-column: 1 / -1; color: rgba(255, 255, 255, .82); }
.summary-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
    margin-bottom: 6px;
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.card-main .summary-value { font-size: 44px; color: #fff; grid-row: 2; }
.summary-value .currency { font-size: .62em; font-weight: 700; margin-right: 2px; opacity: .8; }
.summary-sub { font-size: 12px; color: var(--faint); }
.card-main .summary-sub {
    color: rgba(255, 255, 255, .85);
    background: rgba(255, 255, 255, .14);
    padding: 4px 12px;
    border-radius: 999px;
    align-self: center;
    white-space: nowrap;
}

/* 提醒条 */
.alert-bar {
    background: var(--c-warning-bg);
    border: 1px solid #EBD3AD;
    color: #7A4108;
    padding: 13px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.alert-bar.urgent {
    background: var(--c-danger-bg);
    border-color: #F1C6C6;
    color: #7F1D1D;
}
.alert-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-bar strong { font-weight: 800; font-family: var(--font-num); }
.alert-bar.urgent strong { color: var(--danger); }

/* =========================================================
   热销排行 / 最近订单
   ========================================================= */
.top-items { display: flex; flex-direction: column; gap: 2px; }
.top-item {
    display: flex;
    align-items: center;
    padding: 11px 10px;
    border-radius: 10px;
    transition: background .15s;
}
.top-item:hover { background: var(--bg); }
.top-rank {
    width: 28px; height: 28px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    margin-right: 14px;
    background: var(--surface-2);
    color: var(--muted);
    flex-shrink: 0;
}
.top-item:nth-child(1) .top-rank { background: var(--c-primary); color: #fff; }
.top-item:nth-child(2) .top-rank { background: #C9A37B; color: #fff; }
.top-item:nth-child(3) .top-rank { background: #9C7B57; color: #fff; }
.top-info { flex: 1; min-width: 0; }
.top-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-meta { font-size: 12px; color: var(--faint); margin-top: 2px; }
.top-revenue { font-size: 14px; font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; font-family: var(--font-num); }

.recent-orders { display: flex; flex-direction: column; gap: 2px; }
.recent-order {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 10px;
    border-radius: 10px;
    transition: background .15s;
}
.recent-order:hover { background: var(--bg); }
.ro-left { flex: 1; min-width: 0; }
.ro-row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.ro-table { font-size: 14px; font-weight: 600; color: var(--text); }
.ro-no { font-size: 12px; color: var(--faint); }
.ro-meta { font-size: 12px; color: var(--faint); }
.pay-tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.pay-tag.wechat { background: var(--c-success-bg); color: var(--c-success); }
.pay-tag.alipay { background: var(--c-info-bg); color: var(--c-info); }
.pay-tag.cash   { background: var(--c-warning-bg); color: var(--c-warning); }
.pay-tag.card   { background: var(--c-accent-050); color: var(--c-accent); }
.ro-amount {
    font-size: 15px; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums; font-family: var(--font-num);
    flex-shrink: 0;
}

/* 空态 / 加载 */
.empty-text, .loading-text {
    text-align: center;
    padding: 40px 20px;
    color: var(--faint);
    font-size: 13px;
}
.loading-text { padding: 28px 20px; }

/* =========================================================
   图表容器（Canvas 由 JS 绘制，这里只做卡片包装）
   ========================================================= */
.chart-wrap {
    width: 100%;
    padding: 6px 2px 2px;
}
.chart-wrap canvas { width: 100%; display: block; }

/* =========================================================
   菜品管理
   ========================================================= */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
    display: flex;
    align-items: center;
}
.search-wrap svg {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    pointer-events: none;
}
.search-wrap input {
    width: 100%;
    padding: 9px 12px 9px 38px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: all .2s;
}
.search-wrap input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}
.toolbar select {
    padding: 9px 34px 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    transition: all .2s;
    color: var(--text);
}
.toolbar select:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.menu-filter { margin-bottom: 12px; }

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    grid-auto-rows: max-content;
}
.menu-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all .2s;
    display: flex;
    flex-direction: column;
}
.menu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.menu-card.off { opacity: .62; }
.menu-img-wrap {
    height: 140px;
    background: linear-gradient(135deg, #F5EFE7, var(--surface-2));
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    position: relative;
}
.menu-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.menu-img-ph {
    font-size: 44px;
    filter: saturate(.9);
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
}
.menu-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.menu-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.menu-name { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.menu-desc {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
    flex: 1;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.menu-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.menu-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-dark);
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
}
.menu-actions { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }

/* 徽章体系 */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.badge-cat   { background: var(--primary-tint); color: var(--primary-dark); border-radius: 6px; }
.badge-avail { background: var(--c-success-bg); color: var(--c-success); }
.badge-occ   { background: var(--c-danger-bg); color: var(--c-danger); }
.cat-badge {
    display: inline-flex;
    padding: 2px 8px;
    background: var(--primary-tint);
    color: var(--primary-dark);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.role-badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
/* v2.1：ADMIN 徽章由冷紫改慅石青青（--c-accent），全站唯一强调色 */
.role-purple { background: var(--c-accent-050); color: var(--c-accent); }
.role-blue   { background: var(--c-info-bg); color: var(--c-info); }
.role-green  { background: var(--c-success-bg); color: var(--c-success); }
.role-orange { background: var(--c-warning-bg); color: var(--c-warning); }
.role-gray   { background: var(--surface-2); color: var(--muted); }
/* 旧版角色/状态徽章（保留兼容） */
.role-tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.role-tag.ADMIN   { background: var(--c-accent-050); color: var(--c-accent); }
.role-tag.CASHIER { background: var(--c-info-bg); color: var(--c-info); }
.role-tag.KITCHEN { background: var(--c-success-bg); color: var(--c-success); }
.role-tag.WAITER  { background: var(--c-warning-bg); color: var(--c-warning); }
.status-badge-enable {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 500;
}
.status-badge-enable.enabled  { background: var(--c-success-bg); color: var(--c-success); }
.status-badge-enable.disabled { background: var(--surface-2); color: var(--muted); }
.status-badge-enable::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* 开关 */
.switch-wrap { display: flex; align-items: center; gap: 10px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #D6C9B4;
    border-radius: 24px;
    transition: .2s;
}
.slider::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--c-primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* =========================================================
   桌台管理
   ========================================================= */
.zone-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.zone-tab {
    padding: 8px 20px;
    border-radius: 999px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    transition: all .15s;
}
.zone-tab:hover { border-color: var(--primary); color: var(--primary-dark); }
.zone-tab.active {
    background: var(--c-ink);
    border-color: var(--c-ink);
    color: #fff;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    grid-auto-rows: max-content;
}
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: all .2s;
    position: relative;
    overflow: hidden;
}
.table-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.table-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.table-no { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; font-family: var(--font-num); }
.table-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    padding: 8px 12px;
    background: var(--surface-2);
    border-radius: 8px;
    margin-bottom: 14px;
}
.table-zone { font-size: 12px; font-weight: 600; color: var(--primary-dark); }
.table-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-card-actions .btn { flex: 1; min-width: 0; justify-content: center; }
/* 旧版桌台元素（保留兼容） */
.status-badge { padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.status-badge.AVAILABLE { background: var(--c-success-bg); color: var(--c-success); }
.status-badge.OCCUPIED  { background: var(--c-danger-bg); color: var(--c-danger); }
.status-badge.RESERVED  { background: var(--c-warning-bg); color: var(--c-warning); }
.table-seats { font-size: 13px; color: var(--muted); margin-bottom: 14px; padding: 8px 12px; background: var(--surface-2); border-radius: 8px; }
.table-actions { display: flex; gap: 8px; }
.table-actions .btn-sm { flex: 1; }

/* =========================================================
   数据表（用户/权限等列表）
   ========================================================= */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead { background: var(--surface-2); }
.data-table th {
    padding: 13px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 14px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:nth-child(even) { background: #FBFCFE; }
.data-table tbody tr:hover { background: var(--primary-tint); }
.data-table tbody tr:last-child td { border-bottom: none; }
.u-username { font-weight: 600; color: var(--text); font-family: var(--font-num); }
.u-name { color: var(--text); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--primary-dark);
    transition: all .15s;
    font-weight: 500;
}
.link-btn:hover { background: var(--primary-tint); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--c-danger-bg); }
.link-btn.warning { color: var(--warning); }
.link-btn.warning:hover { background: var(--c-warning-bg); }

/* =========================================================
   权限配置
   ========================================================= */
.perms-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
.perm-hint {
    background: var(--primary-tint);
    color: var(--primary-dark);
    border: 1px solid #EBCDB0;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.roles-col { display: flex; flex-direction: column; gap: 12px; }
.role-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    cursor: pointer;
    transition: all .2s;
}
.role-card:hover { border-color: #D9B992; }
.role-card.selected {
    border-color: var(--primary);
    background: var(--primary-tint);
    box-shadow: 0 0 0 3px rgba(192, 90, 18, .12);
}
.role-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.role-card-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-2);
    font-size: 18px;
}
.role-card.ADMIN   .role-card-icon { background: var(--c-accent-050); color: var(--c-accent); }
.role-card.CASHIER .role-card-icon { background: var(--c-info-bg); }
.role-card.KITCHEN .role-card-icon { background: var(--c-success-bg); }
.role-card.WAITER  .role-card-icon { background: var(--c-warning-bg); }
.role-card-name { font-size: 15px; font-weight: 600; color: var(--text); }
.role-card-desc { font-size: 12px; color: var(--muted); margin-left: 52px; }

.perms-col {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}
.perms-list { padding: 20px; flex: 1; overflow-y: auto; }
.perm-group { margin-bottom: 22px; }
.perm-group:last-child { margin-bottom: 0; }
.perm-group-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .06em;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.perm-grid { display: flex; flex-direction: column; gap: 2px; }
.perm-items { display: flex; flex-direction: column; gap: 2px; }
.perm-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 8px;
    transition: background .15s;
    cursor: pointer;
}
.perm-item:hover { background: var(--bg); }
.perm-item input[type="checkbox"], .perm-cb {
    width: 16px; height: 16px;
    accent-color: var(--c-primary);
    cursor: pointer;
    flex-shrink: 0;
}
.perm-label, .perm-name { flex: 1; font-size: 14px; color: var(--text); cursor: pointer; }
.perm-code {
    padding: 2px 8px;
    background: var(--surface-2);
    color: var(--muted);
    border-radius: 4px;
    font-size: 12px;
    font-family: monospace;
    flex-shrink: 0;
}
.perms-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* =========================================================
   设置 / 系统信息
   ========================================================= */
.user-profile-card {
    background: linear-gradient(135deg, var(--c-ink) 0%, #33291C 100%);
    border-radius: var(--radius);
    padding: 26px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.user-profile-card::after {
    content: "";
    position: absolute;
    right: -30px; top: -50px;
    width: 190px; height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(192, 90, 18, .35), transparent 70%);
    pointer-events: none;
}
.user-avatar-lg {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, .25);
    flex-shrink: 0;
}
.user-info-name { font-size: 20px; font-weight: 700; }
.user-info-role { font-size: 13px; opacity: .75; margin-top: 2px; }

.settings-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}
.settings-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
    width: 100%;
    text-align: left;
    color: var(--text);
    font-size: 14px;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--bg); }
.si-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--primary-tint);
    color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    margin-right: 14px;
    flex-shrink: 0;
}
.si-label { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.si-arrow { color: var(--faint); font-size: 20px; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    grid-auto-rows: max-content;
}
.info-item { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; }
.info-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.info-value {
    font-size: 14px;
    color: var(--text);
    word-break: break-all;
    display: flex;
    align-items: center;
    gap: 8px;
}
.info-value-copy {
    padding: 3px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--primary-dark);
    cursor: pointer;
    flex-shrink: 0;
    transition: all .15s;
}
.info-value-copy:hover { background: var(--primary-tint); }

.sysinfo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    grid-auto-rows: max-content;
}
.sysinfo-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.sysinfo-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sysinfo-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-family: var(--font-num);
}
.host-list { display: flex; flex-direction: column; gap: 6px; }
.host-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface-2);
    border-radius: 8px;
}
.host-addr { font-size: 13px; font-family: monospace; color: var(--text); word-break: break-all; }

/* =========================================================
   Modal（统一弹层语言：桌面居中，移动底部抽屉）
   ========================================================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(28, 22, 16, .55);
    backdrop-filter: blur(2px);
    animation: fadeIn .15s ease;
}
.modal-dialog {
    position: relative;
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(2, 6, 16, .3);
    animation: modalIn .2s ease;
    z-index: 1;
}
.modal-dialog--sm { max-width: 400px; }
.modal-dialog--lg { max-width: 640px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to { opacity: 1; transform: none; }
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: var(--surface-2);
    border-radius: 0 0 16px 16px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-input, .form-textarea, .form-select, .modal-body input[type="text"], .modal-body input[type="number"], .modal-body input[type="password"], .modal-body textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: all .2s;
    background: var(--surface);
    font-size: 14px;
    color: var(--text);
}
.form-textarea, .modal-body textarea { resize: vertical; min-height: 72px; }
.form-input:focus, .form-textarea:focus, .form-select:focus,
.modal-body input:focus, .modal-body textarea:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.file-upload-wrap {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--surface-2);
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.file-upload-wrap:hover, .file-upload-wrap.dragging {
    border-color: var(--primary);
    background: var(--primary-tint);
}
/* 强制隐藏 file input：hidden 属性在某些浏览器会被 CSS 覆盖，
   导致文件框裸露（用户看到的红框就是这个原因） */
#menuImageFile {
    display: none !important;
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
}
.file-upload-wrap svg { color: var(--faint); margin: 0 auto 8px; display: block; }
.file-upload-text { font-size: 14px; color: var(--muted); display: block; width: 100%; }
.file-upload-text strong { color: var(--primary-dark); }
.file-upload-wrap.uploading {
    border-color: var(--primary);
    border-style: solid;
    background: var(--primary-tint);
    pointer-events: none;
}
.file-upload-status {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    display: none;
}
.file-upload-wrap.uploading .file-upload-status { display: block; }
.file-upload-wrap.uploading .file-upload-text { display: none; }
.file-preview { margin-top: 12px; position: relative; display: inline-block; }
.file-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 10px;
    border: 2px solid var(--border);
}
.file-preview-remove {
    position: absolute;
    top: -8px; right: -8px;
    width: 24px; height: 24px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

/* 二维码弹窗 */
.qr-content, .qr-body { text-align: center; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-img-wrap {
    width: 200px;
    margin: 0 auto 16px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.qr-img-wrap svg, .qr-img-wrap canvas { width: 100%; height: auto; display: block; }
.qr-card { background: #fff; padding: 16px; border-radius: 16px; border: 1px solid var(--border); text-align: center; }
.qr-card canvas { display: block; margin: 0 auto; }
.qr-table { font-size: 20px; font-weight: 800; margin-top: 12px; }
.qr-hint { font-size: 12px; color: var(--muted); margin-top: 6px; word-break: break-all; max-width: 280px; }
.qr-url-box {
    background: var(--surface-2);
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}
.qr-url-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.qr-url-text {
    flex: 1;
    font-size: 12px;
    color: var(--text);
    word-break: break-all;
    text-align: left;
    font-family: monospace;
}
.qr-table-label { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.qr-hint-small { font-size: 12px; color: var(--muted); }

/* =========================================================
   Toast / Loading
   ========================================================= */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}
.toast {
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 260px;
    border: 1px solid var(--border);
}
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }
.toast-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}
.toast.success .toast-icon { background: var(--c-success-bg); color: var(--success); }
.toast.error .toast-icon { background: var(--c-danger-bg); color: var(--danger); }
.toast.warning .toast-icon { background: var(--c-warning-bg); color: var(--warning); }
.toast.info .toast-icon { background: var(--primary-tint); color: var(--primary-dark); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 14px; font-weight: 600; color: var(--text); }
.toast-msg { font-size: 12px; color: var(--muted); margin-top: 2px; }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, .78);
    backdrop-filter: blur(2px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   移动端底栏 / 下拉刷新（旧版保留，桌面隐藏）
   ========================================================= */
.tabbar { display: none; }
.tab-item { color: var(--muted); }
.header-title { font-size: 18px; font-weight: 700; }
.pull-indicator {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    z-index: 15;
    height: 0;
    overflow: hidden;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    transition: height .2s ease;
}
.pull-indicator.show { height: 40px; display: flex; box-shadow: 0 4px 10px rgba(0, 0, 0, .06); }
.menu-item-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.menu-thumb {
    width: 52px; height: 52px; border-radius: 12px;
    background: linear-gradient(135deg, var(--c-primary), var(--c-primary-700));
    color: #fff; font-size: 20px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.menu-item-info { flex: 1; min-width: 0; }
.menu-item-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.menu-item-desc { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item-price { font-size: 16px; font-weight: 700; color: var(--primary-dark); margin-top: 4px; font-family: var(--font-num); }
.menu-status-badge { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.menu-status-badge.on { background: var(--c-success-bg); color: var(--c-success); }
.menu-status-badge.off { background: var(--c-danger-bg); color: var(--c-danger); }
.menu-btn-row { display: flex; gap: 6px; }
.menu-btn {
    background: var(--surface); border: 1px solid var(--border); color: var(--muted);
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.menu-btn:hover { color: var(--primary-dark); border-color: var(--primary); }
.menu-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.table-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 8px; text-align: center; cursor: pointer; }
.detail-tab-panel { }

/* 侧边栏抽屉遮罩：可见性完全由 JS 的 hidden 属性控制 */
.sidebar-backdrop {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(2, 6, 16, .45);
}

/* 行为钩子类（JS closest/querySelector 依赖）：统一微排版 */
.login-form { display: block; }
.btn-text { display: inline; }
.num-roll { font-variant-numeric: tabular-nums; }
.menu-avail-toggle { cursor: pointer; }
.menu-edit-btn, .menu-del-btn,
.table-qr-btn, .table-edit-btn, .table-del-btn,
.user-edit-btn, .user-toggle-btn, .user-reset-btn { gap: 4px; }
.copy-host-btn { flex-shrink: 0; }
.eye-open, .eye-off { display: block; }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1024px) {
    .sidebar { width: var(--sidebar-w-collapsed); }
    .sidebar-brand { padding: 0 14px; }
    .sidebar-brand-text, .nav-text { display: none; }
    .nav-item { justify-content: center; padding: 12px; }
    .nav-item.active::before { left: 0; top: 6px; bottom: 6px; }
    .app-main-wrap { margin-left: var(--sidebar-w-collapsed); }
    .sidebar-toggle { display: inline-flex; }
    .perms-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w);
        box-shadow: 12px 0 40px rgba(2, 6, 16, .45);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-brand { padding: 0 20px; }
    .sidebar-brand-text, .nav-text { display: block; }
    .nav-item { justify-content: flex-start; padding: 10px 14px; }
    .app-main-wrap { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .data-table { min-width: 560px; }
    .detail-tab-panel { overflow-x: auto; }
    .summary-card.card-main { grid-template-columns: 1fr; align-items: start; }
    .card-main .summary-value { font-size: 36px; }
    .card-main .summary-sub { justify-self: start; }
}
@media (max-width: 640px) {
    .app-main { padding: 14px; }
    .app-header { padding: 0 16px; }
    .user-info-wrap { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .toast-container { left: 12px; right: 12px; top: 12px; max-width: none; }
    .summary-card { padding: 16px; }
    .summary-value { font-size: 24px; }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }
    .card-section { padding: 16px; }
    .modal { padding: 10px; align-items: flex-end; }
    .modal-dialog { border-radius: 18px 18px 12px 12px; animation: sheetUp .28s cubic-bezier(.22, 1, .36, 1) both; }
    @keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (max-width: 480px) {
    .summary-grid { grid-template-columns: 1fr; }
    .header-title { font-size: 16px; }
}


/* ============================================================
   设计系统升级层 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; }

/* ---- 品牌与标题 ---- */
#pageTitle { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }
.login-title { font-family: var(--font-display); font-weight: 600; }
.sidebar-brand-text { letter-spacing: -0.01em; }

/* ---- 顶栏：磨砂玻璃（内容从下方滚过，层次更通透） ---- */
.app-header {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
}

/* ---- 卡片与导航 ---- */
.nav-item { transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out); }
.card { box-shadow: var(--shadow-1), var(--hairline); }
.card-section { transition: box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
.card-section:hover { box-shadow: var(--glow-soft); }
.table-card:hover { box-shadow: var(--glow-soft); }
.user-profile-card { box-shadow: var(--shadow-2); }

/* =========================================================
   追加：区域管理弹窗 / 菜品小缩略图 / 表单提示
   （延续既有令牌与弹窗语言，不改既有规则）
   ========================================================= */

/* 小字提示（表单输入框下方） */
.form-hint { font-size: 12px; color: var(--faint); margin-top: 6px; line-height: 1.5; }

/* 桌台工具栏右侧按钮组 */
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 区域管理弹窗：区域行 */
.zone-manage-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.zone-manage-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.zone-manage-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}
.zone-manage-count { font-size: 12px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.zone-rename-input {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    transition: all .2s;
}
.zone-rename-input:focus { border-color: var(--primary); box-shadow: var(--shadow-focus); }
.zone-manage-row .btn { flex-shrink: 0; }

/* 区域管理弹窗：新增行 */
.zone-add-row { display: flex; align-items: center; gap: 8px; }
.zone-add-row .form-input { flex: 1; min-width: 0; }
.zone-add-row .btn { flex-shrink: 0; }

/* 菜品卡片操作区的小缩略图（36px 圆角，无图/加载失败显示占位） */
.menu-thumb-sm {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #F5EFE7, var(--surface-2));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.menu-thumb-sm::after { content: '🥘'; font-size: 18px; line-height: 1; }
.menu-thumb-sm img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}
.menu-actions .menu-img-btn { margin-right: auto; }

/* ===================== 单据详情弹窗（营收） ===================== */
.od-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--c-line); margin-bottom: 14px; }
.od-no { font-size: 16px; font-weight: 700; color: var(--c-ink); }
.od-meta { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.od-section { margin-bottom: 16px; }
.od-section-title { font-size: 13px; font-weight: 700; color: var(--c-ink); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.od-section-title::before { content: ''; width: 3px; height: 13px; border-radius: 2px; background: var(--primary); }
.od-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.od-item { font-size: 13px; color: var(--c-ink-soft); line-height: 1.6; }
.od-label { color: var(--faint); }
.od-cancel { background: var(--c-danger-bg); border-radius: 12px; padding: 12px 14px; }
.od-items-table th { font-size: 12px; white-space: nowrap; }
.od-items-table td { font-size: 13px; vertical-align: top; }
@media (max-width: 640px) {
    .od-grid { grid-template-columns: 1fr; }
    .od-items-table th:nth-child(3), .od-items-table td:nth-child(3),
    .od-items-table th:nth-child(5), .od-items-table td:nth-child(5) { display: none; }
}

/* ===================== 打印机设置（2026-11-10 新增，只增不改） ===================== */
.printer-error-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.printer-error-text { font-size: 13px; color: var(--danger); }
.printer-name { font-weight: 600; color: var(--text); }
.printer-target {
    font-family: var(--font-num);
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}
.printer-role-badge { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.printer-role--kitchen { background: var(--c-primary-050); color: var(--c-primary-600); }
.printer-role--cashier { background: var(--c-accent-050); color: var(--c-accent); }
.printer-field-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    padding: 14px 14px 0;
    margin-bottom: 16px;
}
.printer-cloud-kv {
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
    padding: 8px 2px; border-bottom: 1px dashed var(--border); font-size: 13px;
}
.printer-cloud-kv:last-child { border-bottom: none; }
.printer-cloud-key { color: var(--muted); flex-shrink: 0; }
.printer-cloud-val { color: var(--text); font-weight: 600; text-align: right; word-break: break-all; font-family: var(--font-num); }
.printer-bind-section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.printer-bind-section .section-head { margin-bottom: 10px; }

/* ===== 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 防竖排：窄屏下身份/导航类短文本禁止折行（超出显示省略号） ===== */
/* 内容类文本（备注/菜名/描述）仍保留正常换行；此规则只约束 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) {
    .header-left { flex: 1 1 auto; min-width: 0; }
    #pageTitle { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-actions { flex-shrink: 0; gap: 6px; }
    .user-chip-name, .user-chip-role { white-space: nowrap; }
    .user-chip-role { display: none; }
}
