/* ========== CSS Variables & Themes（与 shared-theme.css 完全一致，不新增颜色）========== */
:root {
    --bg: #0d1117;
    --bg2: #161b22;
    --bg3: #21262d;
    --fg: #e6edf3;
    --fg2: #8b949e;
    --fg3: #484f58;
    --accent: #58a6ff;
    --accent2: #1f6feb;
    --accent-glow: rgba(88, 166, 255, 0.15);
    --border: #30363d;
    --code-bg: #161b22;
    --success: #3fb950;
    --warn: #d29922;
    --err: #f85149;
    --radius: 8px;
    --transition: 0.25s ease;
    /* 本工具特有：局部缩放，只作用于商品宫格与金额区，不影响 header 按钮 */
    --till-scale: 1;
    --card-min: 150px;
}

[data-theme="light"] {
    --bg: #ffffff;
    --bg2: #f6f8fa;
    --bg3: #eaeef2;
    --fg: #1f2328;
    --fg2: #656d76;
    --fg3: #afb8c1;
    --accent: #0969da;
    --accent2: #0550ae;
    --accent-glow: rgba(9, 105, 218, 0.1);
    --border: #d0d7de;
    --code-bg: #f6f8fa;
}

/* ========== Reset & Base ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* 根字号固定，缩放只作用于局部（沿用 f6e0622 确立的模式） */
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.num {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
}

.hidden {
    display: none !important;
}

/* ========== App Shell ========== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ========== Header（结构与既有工具一致）========== */
header {
    flex-shrink: 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.logo span {
    opacity: 0.6;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--fg2);
}

.seal-container {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    cursor: pointer;
}

.seal-container canvas {
    display: block;
}

.controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#btn-lang {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--fg);
    border-radius: var(--radius);
    padding: 4px 8px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.controls button {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 5px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.controls button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.controls button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ========== Buttons ========== */
.btn-primary {
    background: var(--accent2);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-primary:hover {
    background: var(--accent);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg3);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ========== Session Bar ========== */
.session-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--fg2);
}

.session-bar .grow {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.session-bar .icon-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--fg2);
    border-radius: var(--radius);
    width: 28px;
    height: 26px;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

.session-bar .icon-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ========== Panels ========== */
.panel {
    display: none;
    flex: 1;
    min-height: 0;
}

.panel.active {
    display: flex;
}

/* ========== Till Layout ========== */
#panel-till {
    flex-direction: column;
}

.till-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.till-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.till-scroll {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 8px;
}

/* ========== Multiplier Bar ========== */
.mult-bar {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.mult-bar::-webkit-scrollbar {
    display: none;
}

.mult {
    flex: 1;
    min-width: 52px;
    padding: 8px 4px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg2);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    touch-action: manipulation;
    user-select: none;
}

.mult.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.mult.locked::after {
    content: '🔒';
    font-size: 0.7rem;
    margin-left: 2px;
}

/* ========== Item Grid ========== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: 8px;
    font-size: calc(1rem * var(--till-scale));
}

.card {
    position: relative;
    min-height: 5.3em;
    padding: 0.55em 0.6em 0.55em 0.85em;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.08s ease, background var(--transition), border-color var(--transition);
    touch-action: manipulation;
    user-select: none;
    -webkit-touch-callout: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.1em;
}

/* 左侧配色条：6 个 hue 由同一条规则派生，不引入新的品牌色 */
.card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: hsl(var(--h, 210) 68% 55%);
}

.card[data-c="0"] { --h: 210; }
.card[data-c="1"] { --h: 145; }
.card[data-c="2"] { --h: 35; }
.card[data-c="3"] { --h: 350; }
.card[data-c="4"] { --h: 280; }
.card[data-c="5"] { --h: 190; }

.card:active {
    transform: scale(0.96);
    background: var(--bg3);
}

.card.picked {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.card .emoji {
    font-size: 1.6em;
    line-height: 1.1;
}

.card .cname {
    font-size: 0.9em;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card .cprice {
    font-size: 0.8em;
    color: var(--fg2);
}

.card .qty {
    position: absolute;
    top: 0.25em;
    right: 0.3em;
    min-width: 1.55em;
    height: 1.55em;
    padding: 0 0.3em;
    background: var(--accent);
    color: #fff;
    border-radius: 1em;
    font-size: 0.82em;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

.card.has .qty {
    display: flex;
}

.card .minus {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 2.6em;
    height: 2.4em;
    border: none;
    background: none;
    color: var(--fg2);
    font-size: 0.9em;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.card.has .minus {
    display: flex;
}

.card .minus:active {
    color: var(--err);
}

/* 长按清零的进度反馈 */
.card.longpress {
    animation: flash 0.3s ease;
}

@keyframes flash {
    0% { background: var(--accent-glow); }
    100% { background: var(--bg2); }
}

/* ========== Cart Lines ========== */
/* 单份 DOM：窄屏时贴在总计栏上方常驻（宫格独立滚动），宽屏时移入右栏 */
.till-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg2);
}

.lines-wrap {
    max-height: 26dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 14px 2px;
    border-top: 1px solid var(--border);
}

.lines-wrap.empty {
    display: none;
}

.lines-title {
    font-size: 0.78rem;
    color: var(--fg3);
    padding: 0 2px 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 2px;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

/* 只有本次新增/变更的行才播放高亮，避免整列表每次重建都闪 */
.line.in {
    animation: lineIn 0.45s ease;
}

@keyframes lineIn {
    from { background: var(--accent-glow); }
    to { background: transparent; }
}

.line .lname {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line .lcalc {
    color: var(--fg2);
    font-size: 0.82rem;
    white-space: nowrap;
}

.line .lsub {
    min-width: 5.5em;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.line-btns {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.line-btns button {
    width: 32px;
    height: 32px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg2);
    font-size: 0.85rem;
    cursor: pointer;
    touch-action: manipulation;
    line-height: 1;
}

.line-btns button:active {
    background: var(--accent-glow);
    color: var(--accent);
}

.empty-hint {
    text-align: center;
    color: var(--fg3);
    font-size: 0.85rem;
    padding: 18px 8px;
}

/* ========== Empty State（首次引导）========== */
.guide {
    text-align: center;
    padding: 40px 20px;
    color: var(--fg2);
}

.guide .gicon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.guide h2 {
    font-size: 1.15rem;
    color: var(--fg);
    margin-bottom: 10px;
}

.guide p {
    font-size: 0.88rem;
    margin-bottom: 20px;
    line-height: 1.7;
}

.guide .gbtns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 280px;
    margin: 0 auto;
}

/* ========== Total Bar ========== */
.totalbar {
    flex-shrink: 0;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
}

.total-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: calc(1rem * var(--till-scale));
}

.total-count {
    font-size: 0.85em;
    color: var(--fg2);
}

.total-amt {
    font-size: 2.2em;
    font-weight: 700;
    line-height: 1.1;
    transition: transform 0.12s ease;
}

.total-amt.bump {
    transform: scale(1.05);
}

.total-btns {
    display: flex;
    gap: 8px;
}

/* 长按清空：进度由 background-size 从 0 推到 100% */
.btn-clear {
    position: relative;
    flex-shrink: 0;
    padding: 10px 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg2);
    font-size: 0.85rem;
    cursor: pointer;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
}

.btn-clear::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: var(--err);
    opacity: 0.25;
}

.btn-clear.holding::before {
    width: 100%;
    transition: width 0.8s linear;
}

.btn-pay {
    flex: 1;
    padding: 12px;
    background: var(--accent2);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.btn-pay:active {
    background: var(--accent);
}

.btn-pay:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ========== Pay Panel ========== */
.pay-mask {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
    display: none;
}

.pay-mask.open {
    display: block;
}

.pay-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 201;
    max-height: 94dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    transform: translateY(102%);
    transition: transform 0.2s ease;
    padding-bottom: env(safe-area-inset-bottom);
}

.pay-panel.open {
    transform: translateY(0);
}

.pay-head {
    flex-shrink: 0;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    position: relative;
}

.pay-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    color: var(--fg2);
    font-size: 1.1rem;
    cursor: pointer;
}

.pay-due {
    font-size: 0.95rem;
    color: var(--fg2);
}

.pay-paid {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.pay-change {
    font-size: 2.1rem;
    font-weight: 800;
    margin-top: 6px;
    color: var(--fg3);
}

.pay-change.ok {
    color: var(--success);
}

.pay-change.short {
    color: var(--err);
}

.pay-break {
    font-size: 0.78rem;
    color: var(--fg2);
    margin-top: 3px;
    min-height: 1.2em;
}

.pay-break .rest {
    color: var(--warn);
}

.pay-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 12px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.chip {
    flex: 1 1 auto;
    min-width: 62px;
    padding: 10px 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 0.85rem;
    cursor: pointer;
    touch-action: manipulation;
    white-space: nowrap;
}

.chip:active {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.chip.round {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

/* ========== Keypad ========== */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 8px;
}

.key {
    height: 56px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.key:active {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.key.fn {
    color: var(--fg2);
    font-size: 1.1rem;
}

.pay-foot {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
}

.pay-foot .btn-secondary {
    flex-shrink: 0;
}

.btn-done {
    flex: 1;
    padding: 13px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
}

.btn-done.short {
    background: var(--warn);
}

.btn-done:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ========== Setup Mode ========== */
#panel-setup {
    flex-direction: column;
    overflow-y: auto;
}

.setup-wrap {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 14px 14px 40px;
}

.sec {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.sec-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.sec-title .sub {
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--fg2);
    text-align: right;
}

.sec-title .sub.over {
    color: var(--warn);
}

.seg {
    display: flex;
    gap: 6px;
}

.seg button {
    flex: 1;
    padding: 10px 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg2);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.seg button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.sec-title-2 {
    margin: 14px 0 0;
}

.notes-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
}

.note-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px 5px 10px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
}

.note-chip button {
    background: none;
    border: none;
    color: var(--fg3);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 2px;
}

.note-chip button:hover {
    color: var(--err);
}

/* ===== Item Editor Rows ===== */
.irow {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.irow.incomplete {
    background: rgba(210, 153, 34, 0.08);
}

.irow.incomplete .i-name,
.irow.incomplete .i-price {
    border-color: var(--warn);
}

.irow input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 0.88rem;
    padding: 8px;
    outline: none;
    min-width: 0;
    transition: border var(--transition);
}

.irow input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.irow .i-emoji {
    width: 46px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.05rem;
}

.irow .i-name {
    flex: 1;
}

.irow .i-price {
    width: 84px;
    flex-shrink: 0;
    text-align: right;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.dots {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    background: hsl(var(--h) 68% 55%);
}

.dot[data-c="0"] { --h: 210; }
.dot[data-c="1"] { --h: 145; }
.dot[data-c="2"] { --h: 35; }
.dot[data-c="3"] { --h: 350; }
.dot[data-c="4"] { --h: 280; }
.dot[data-c="5"] { --h: 190; }

.dot.on {
    border-color: var(--fg);
}

.irow-btns {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.irow-btns button {
    width: 28px;
    height: 30px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg2);
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1;
}

.irow-btns button:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.irow-btns button.del:hover {
    color: var(--err);
    border-color: var(--err);
}

.warn-note {
    font-size: 0.8rem;
    color: var(--warn);
    padding: 8px 0 0;
}

/* ===== Stall Link ===== */
.link-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 10px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.72rem;
    color: var(--fg2);
    word-break: break-all;
    max-height: 76px;
    overflow-y: auto;
    line-height: 1.5;
}

.link-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tip {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--fg);
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 84px;
    transform: translateX(-50%) translateY(20px);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 24px);
    padding: 10px 12px 10px 16px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast button {
    background: none;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius);
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

/* ========== Modal（确认框）========== */
.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-mask.open {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 340px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
}

.modal h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.modal p {
    font-size: 0.86rem;
    color: var(--fg2);
    line-height: 1.7;
    margin-bottom: 16px;
    white-space: pre-wrap;
}

.modal textarea {
    width: 100%;
    min-height: 78px;
    margin-bottom: 14px;
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    resize: vertical;
    outline: none;
}

.modal textarea:focus {
    border-color: var(--accent);
}

.modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ========== Fullscreen（CSS 伪全屏，主方案）========== */
body.fs header,
body.fs .session-bar {
    display: none;
}

.fs-exit {
    display: none;
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 150;
    width: 44px;
    height: 44px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--fg2);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity var(--transition);
}

.fs-exit:hover {
    opacity: 1;
}

body.fs .fs-exit {
    display: block;
}

body.fs .till-scroll {
    padding-top: 8px;
}

/* ========== Responsive ========== */
@media (min-width: 600px) {
    :root {
        --card-min: 160px;
    }

    .till-scroll {
        padding: 12px 16px 10px;
    }
}

/* 平板横屏 / 桌面：双栏 */
@media (min-width: 900px) {
    :root {
        --card-min: 172px;
    }

    .till-main {
        flex-direction: row;
    }

    .till-right {
        width: 360px;
        border-left: 1px solid var(--border);
    }

    .lines-wrap {
        flex: 1;
        max-height: none;
        padding: 12px 14px;
        border-top: none;
    }

    /* 双栏下即使空车也保留右栏结构，避免总计栏跳动 */
    .lines-wrap.empty {
        display: block;
    }

    .pay-panel {
        left: auto;
        right: 0;
        width: 420px;
        border-left: 1px solid var(--border);
    }

    .toast {
        bottom: 96px;
    }
}

@media (max-width: 400px) {
    :root {
        --card-min: 132px;
    }

    .logo {
        font-size: 1rem;
    }

    .logo span {
        display: none;
    }

    header {
        padding: 8px 12px;
    }
}
