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

:root {
    --primary: var(--primary);
    --primary-dark: var(--primary-dark);
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

/* ========== 登录页面 ========== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.1);
    width: 420px;
    max-width: 90%;
    position: relative;
    z-index: 1;
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25), 0 0 0 1px rgba(255,255,255,0.1);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 8px;
    color: var(--gray-900);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-box .subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-box .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all 0.2s;
    background: white;
}

.login-box .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.login-box .form-group input::placeholder {
    color: var(--gray-400);
}

/* ========== 侧边栏 ========== */
.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    box-shadow: 4px 0 24px rgba(0,0,0,0.08);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.logo {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo h2 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    margin: 2px 12px;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    color: var(--gray-400);
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: white;
    border-radius: 0 3px 3px 0;
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 20px;
    width: 24px;
    text-align: center;
    filter: grayscale(0.3);
    transition: filter 0.2s;
}

.nav-item:hover .icon,
.nav-item.active .icon {
    filter: grayscale(0);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

.sidebar-footer select {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.sidebar-footer select:focus {
    border-color: var(--primary-light);
    background: rgba(255,255,255,0.08);
}

.sidebar-footer select option {
    background: var(--gray-800);
    color: white;
}

.sidebar-footer .btn-block {
    margin-top: 10px;
}

/* ========== 主内容区域 ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    background: var(--gray-100);
    min-height: 100vh;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    margin-bottom: 24px;
    color: var(--gray-900);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    margin-bottom: 0;
}

#dashboard h1 {
    margin-bottom: 0;
    text-align: center;
    width: 100%;
    font-size: 4em;
}

/* ========== 按钮 ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
    display: block;
}

/* ========== 搜索和筛选 ========== */
.search-bar, .filter-bar {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-bar input, .filter-bar input, .filter-bar select {
    padding: 10px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: white;
    transition: all 0.2s;
    color: var(--gray-700);
}

.search-bar input:focus, .filter-bar input:focus, .filter-bar select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-bar input {
    flex: 1;
}

.search-bar input::placeholder {
    color: var(--gray-400);
}

/* ========== 表格 ========== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    color: var(--gray-600);
    padding: 14px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    font-size: 14px;
}

.data-table tbody tr {
    transition: all 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--gray-50);

}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info p {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

/* ========== 内容区块 ========== */
.dashboard-section, .alert-section, .check-section, .settings-section {
    background: white;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease;
}

.dashboard-section:hover, .alert-section:hover, .check-section:hover, .settings-section:hover {
    box-shadow: var(--shadow-md);
}

.dashboard-section h2, .alert-section h3, .check-section h3, .settings-section h3 {
    margin-bottom: 20px;
    color: var(--gray-900);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-section {
    margin-bottom: 32px;
    border-left: 4px solid var(--warning);
}

/* ========== 弹窗 ========== */
/* 注意：不使用 backdrop-filter（毛玻璃）——它与 transform/滚动叠加时在部分浏览器上
   会造成合成层点击命中错乱（看得见点不着，刷新才恢复），收益极小风险大 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    max-height: 90dvh; /* 平板/手机上按可见视口，避免超出被裁 */
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translate(var(--drag-x, 0px), var(--drag-y, 0px));
}

/* v142j9：弹窗可拖动 —— 按住标题栏拖走；拖动时关闭过渡动画避免跟手延迟 */
.modal.active .modal-content.dragging {
    transition: none;
    cursor: grabbing;
}
#modal h2,
#modal .modal-drag-handle {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

/* v95: 宽版弹窗（优惠券批量群发等需要大空间的场景） */
.modal.modal-wide .modal-content {
    max-width: 1080px;
    width: 96%;
    padding: 24px 28px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

/* ========== 表单 ========== */

/* ========== 收银台宽屏布局 ========== */
/* 不要用 100vh + 垂直居中：平板/手机浏览器 100vh 大于可视高度，
   内容会比屏幕高，居中后顶部（标题、关闭按钮）会被顶出可视区。
   改为让内容铺满遮罩层（stretch），高度由遮罩层决定。 */
.modal.cashier-modal {
    align-items: stretch;
}

.modal.cashier-modal .modal-content {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: none;
    border-radius: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 让 modal-body 撑满剩余高度，收银台三栏才能正确铺满（注意是 id，不是 class） */
.modal.cashier-modal #modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.cashier-layout {
    display: grid;
    grid-template-columns: 374px 1fr 427px;
    grid-template-rows: minmax(0, 1fr); /* 行高锁死为容器高度，内部才能滚动 */
    gap: 16px;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.cashier-panel {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px;
    overflow-y: auto;
    min-height: 0; /* 允许在网格中被压缩，内部列表才能出现滚动条 */
}

.cashier-panel h4 {
    font-size: 26px;
    color: #000;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cashier-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.cashier-product-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.cashier-product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.cashier-product-card .cp-name {
    font-size: 17px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cashier-product-card .cp-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.cashier-product-card .cp-price {
    font-size: 18px;
    font-weight: 600;
    color: #ef4444;
}

.cashier-product-card .cp-stock {
    font-size: 14px;
    color: #94a3b8;
}

.cashier-cart-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.15s;
}

.cashier-cart-item:hover {
    border-color: #c7d2fe;
}

.cashier-cart-item .ci-name {
    flex: 1;
    font-size: 19.5px;
    font-weight: 500;
    color: #1e293b;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cashier-cart-item .ci-qty {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cashier-cart-item .ci-qty button {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.cashier-cart-item .ci-qty button:hover {
    background: #e2e8f0;
}

.cashier-cart-item .ci-qty span {
    min-width: 28px;
    text-align: center;
    font-size: 19.5px;
    font-weight: 600;
}

.cashier-cart-item .ci-price {
    width: 80px;
    text-align: right;
}

.cashier-cart-item .ci-price input {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 19.5px;
    text-align: right;
    background: transparent;
    color: #1e293b;
}

.cashier-cart-item .ci-price input:focus {
    border-color: var(--primary);
    background: white;
    outline: none;
}

.cashier-cart-item .ci-subtotal {
    font-size: 19.5px;
    font-weight: 600;
    color: #ef4444;
    min-width: 70px;
    text-align: right;
}

.cashier-cart-item .ci-stock {
    font-size: 16.5px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 36px;
    text-align: center;
}

.cashier-cart-item .ci-remove {
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    padding: 0 2px;
}

.cashier-cart-item .ci-remove:hover {
    color: #ef4444;
}

.cashier-summary {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
}

.cashier-summary .cs-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 22px;
    color: #64748b;
}

.cashier-summary .cs-row.total {
    font-size: 30px;
    font-weight: 700;
    color: #1e293b;
    border-top: 2px solid #e2e8f0;
    padding-top: 8px;
    margin-top: 4px;
}

.cashier-summary .cs-row.discount {
    color: #ef4444;
}

/* v105: 积分抵扣行 */
.cashier-summary .cs-row.points {
    color: #8b5cf6;
}

.cashier-customer-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef2ff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--primary);
}

.cashier-customer-tag .cct-remove {
    cursor: pointer;
    font-size: 14px;
    color: var(--primary);
}

.cashier-customer-tag .cct-remove:hover {
    color: #ef4444;
}

.cashier-search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 17px;
    outline: none;
    transition: border-color 0.15s;
}

.cashier-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.cashier-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 4px;
}

.cashier-search-results .csr-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cashier-search-results .csr-item:hover {
    background: #f8fafc;
}

.cashier-search-results .csr-item:last-child {
    border-bottom: none;
}

.suspended-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
    font-size: 12px;
}

.suspended-item .si-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suspended-item .si-name {
    font-weight: 500;
    color: #1e293b;
}

.suspended-item .si-meta {
    color: #94a3b8;
    font-size: 11px;
}

.cashier-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 8px;
    margin-top: 12px;
}

.cashier-actions .btn {
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .cashier-layout {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        grid-auto-rows: auto;
        min-height: auto;
        overflow-y: auto; /* 竖屏堆叠时整栏可上下滚动 */
    }
    .modal.cashier-modal .modal-content {
        max-width: 100%;
        width: 100%;
        border-radius: 0;
    }
}
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-800);
    background: white;
    transition: all 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group input::placeholder {
    color: var(--gray-400);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ========== 报表标签页 ========== */
.report-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: white;
    padding: 6px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    width: fit-content;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
}

.tab-btn:hover {
    color: var(--gray-700);
    background: var(--gray-100);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.report-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.report-content.active {
    display: block;
}

.report-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-item {
    text-align: center;
    padding: 24px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.summary-item h4 {
    color: var(--gray-500);
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-item p {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

/* ========== 状态标签 ========== */
.status-normal {
    color: var(--success);
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
}

.status-warning {
    color: var(--danger);
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
}

.status-low {
    color: var(--warning);
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 7px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========== 商品拖动排序 ========== */
#products-list tr[draggable="true"] {
    cursor: grab;
}

#products-list tr.dragging {
    opacity: 0.5;
    background: var(--gray-100);
}

#products-list tr.drop-before > td {
    border-top: 2px solid var(--primary);
}

#products-list tr.drop-after > td {
    border-bottom: 2px solid var(--primary);
}

/* ========== 商品类型切换 ========== */
.type-switch { display: flex; gap: 10px; }
.type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    color: var(--gray-700);
}
.type-btn b { font-size: 14px; color: var(--gray-900); font-weight: 600; }
.type-btn span { font-size: 12px; color: var(--gray-500); }
.type-btn.active { border-color: var(--primary); background: #eef2ff; }
.type-btn.active b { color: var(--primary); }

/* ========== 规格设置 ========== */
.spec-section { border-top: 1px solid var(--gray-200); margin-top: 14px; padding-top: 12px; }
.spec-title { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 10px; }
.spec-empty { font-size: 12px; color: var(--gray-400); }
.spec-dim { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 10px; }
.spec-dim-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.spec-dim-name { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.spec-del { border: none; background: none; color: var(--gray-400); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.spec-del:hover { color: var(--danger); }
.spec-values { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; min-height: 20px; }
.spec-check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gray-700); cursor: pointer; }
.spec-check input { width: 14px; height: 14px; cursor: pointer; }
.spec-check-all { font-weight: 600; color: var(--primary); }
.spec-chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2ff; color: var(--primary); border: 1px solid #c7d2fe; border-radius: 12px; padding: 2px 8px; font-size: 12px; }
.chip-x { cursor: pointer; color: #818cf8; font-weight: 700; }
.chip-x:hover { color: var(--danger); }
.spec-add-row { display: flex; gap: 8px; }
.spec-add-row input { flex: 1; padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; }
.batch-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.batch-row .batch-item { display: flex; flex-direction: column; gap: 4px; }
.batch-row .batch-item > label { font-size: 12px; color: var(--gray-600); line-height: 1; font-weight: 600; }
.batch-row input { width: 110px; padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; }
.batch-row .batch-item-btn { justify-content: flex-end; }

/* 组合明细表 */
.combo-scroll { max-height: 320px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); }
.combo-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.combo-table th, .combo-table td { padding: 6px 8px; border-bottom: 1px solid var(--gray-100); text-align: left; white-space: nowrap; }
.combo-table th { background: var(--gray-50); font-weight: 600; color: var(--gray-600); position: sticky; top: 0; }
.combo-table .combo-spec { color: var(--gray-700); }
.combo-input { width: 100%; min-width: 80px; padding: 5px 8px; border: 1px solid var(--gray-200); border-radius: 4px; font-size: 13px; box-sizing: border-box; }
.combo-hint { font-size: 12px; color: var(--gray-400); padding: 14px; text-align: center; background: var(--gray-50); border-radius: var(--radius-sm); }

/* ========== 商品列表（按商品分组） ========== */
#products-list tr.prod-row { cursor: pointer; }
#products-list tr.prod-row.expanded { background: var(--gray-50); }
#products-list tr.detail-row > td { padding: 0 0 10px 0; background: var(--gray-50); }
.detail-wrap { padding: 8px 12px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; border: 1px solid var(--gray-200); }
.detail-table th, .detail-table td { padding: 6px 10px; border-bottom: 1px solid var(--gray-100); text-align: left; white-space: nowrap; }
.detail-table th { background: var(--gray-50); color: var(--gray-600); font-weight: 600; }
.prod-ops { white-space: nowrap; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar {
        width: 64px;
    }

    .sidebar .logo h2,
    .sidebar .nav-item span:not(.icon) {
        display: none;
    }

    .main-content {
        margin-left: 64px;
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .report-tabs {
        flex-wrap: wrap;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ========== 打印样式 ========== */
@media print {
    .sidebar, .page-header .btn, .search-bar, .filter-bar {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        padding: 0;
    }

    .data-table {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========== 手机/窄屏增强适配 ========== */
@media (max-width: 820px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* 页面内容允许横向滑动，避免内容被截断 */
    .page {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 12px;
    }

    .data-table {
        min-width: 680px;
    }

    .main-content {
        padding: 14px 12px 24px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    /* 登录框适配手机 */
    .login-box {
        width: 92%;
        max-width: 420px;
        box-sizing: border-box;
        margin: 0 auto;
    }

    /* 收银台/盘点等三栏布局改为单列，可上下滚动 */
    .cashier-layout {
        grid-template-columns: 1fr !important;
    }

    /* 隐藏商户端侧边栏标题/副标题；footer 改紧凑式保留分店切换与退出登录 */
    .sidebar .logo,
    .sidebar .logo h2,
    .sidebar .logo h3,
    .sidebar .logo p,
    .sidebar .sidebar-footer label {
        display: none;
    }
    .sidebar {
        overflow-y: auto;
        overflow-x: hidden;
    }
    .sidebar .sidebar-footer {
        display: block;
        padding: 8px 6px;
    }
    .sidebar .sidebar-footer select {
        width: 100%;
        font-size: 12px;
        padding: 4px 4px;
    }
    .sidebar .sidebar-footer .btn-block {
        font-size: 12px;
        padding: 6px 4px;
    }

    /* 后台管理侧边栏改为顶部横向菜单 */
    .admin-body {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100% !important;
        padding: 6px 8px !important;
        display: flex !important;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .admin-sidebar .menu-item {
        padding: 8px 14px !important;
        font-size: 13px;
        white-space: nowrap;
        border-radius: 6px;
        flex: 0 0 auto;
    }
    .admin-main {
        padding: 14px 12px !important;
    }

    /* 租户表格改为可横滑 */
    .tenant-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tenant-table table {
        min-width: 720px;
    }

    /* 表格整体 padding 缩小 */
    .page-header {
        padding: 10px 0;
    }

    /* 首页统计卡：强制单列，避免横向溢出 */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    .stat-card {
        padding: 12px !important;
    }
    .stat-info h3 {
        font-size: 13px !important;
    }
    .stat-info p {
        font-size: 22px !important;
    }

    /* 顶部栏（面包屑/标题）不挤压 */
    .page-header > div {
        flex-wrap: wrap;
    }

    /* 过滤栏/搜索栏换行，避免被截断 */
    .filter-bar,
    .search-bar,
    .form-bar {
        flex-wrap: wrap !important;
    }
    .filter-bar > *,
    .search-bar > *,
    .form-bar > * {
        flex: 1 1 100%;
        margin-bottom: 6px;
    }

    /* 模态/收银台弹层允许横向滑动，不被截断 */
    #modal,
    #modal .modal-body,
    .cashier-modal,
    .cashier-layout {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    #modal .modal-body {
        width: 100% !important;
    }
    .modal-box {
        width: 92% !important;
        max-width: 480px !important;
        box-sizing: border-box;
    }

    /* 商品选择卡片/卡片网格单列 */
    .cashier-product-grid,
    .search-results-grid,
    .form-row {
        grid-template-columns: 1fr !important;
    }

    /* 表格单元格不强制最小宽度，让列自适应 */
    .data-table th,
    .data-table td {
        white-space: nowrap;
    }
}

/* 收银台多规格选择弹窗 */
#spec-picker-layer, #member-picker-layer { position: fixed; inset: 0; z-index: 3000; }
.spec-picker-mask { position: absolute; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.spec-picker { background: #fff; border-radius: 12px; width: 100%; max-width: 480px; max-height: 85vh; overflow-y: auto; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.sp-header { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700; color: #1e293b; margin-bottom: 14px; }
.sp-close { font-size: 22px; line-height: 1; cursor: pointer; color: #94a3b8; padding: 0 2px; }
.sp-close:hover { color: #475569; }
.sp-name { font-size: 18px; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.sp-meta { font-size: 13px; color: #64748b; margin-bottom: 16px; }
.sp-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.sp-label { flex: 0 0 auto; font-size: 13px; color: #475569; padding-top: 8px; min-width: 64px; }
.sp-vals { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-val { min-width: 64px; padding: 8px 14px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; font-size: 14px; color: #334155; cursor: pointer; text-align: center; transition: all .15s; }
.sp-val:hover { border-color: #94a3b8; }
.sp-val.active { border-color: #2563eb; color: #2563eb; font-weight: 600; background: #eff6ff; }
.sp-val.zero { color: #cbd5e1; background: #f8fafc; }
.sp-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.sp-qty { display: flex; align-items: center; gap: 0; }
.sp-qty-btn { width: 36px; height: 36px; border: 1px solid #e2e8f0; background: #fff; font-size: 18px; color: #334155; cursor: pointer; line-height: 1; }
.sp-qty-btn:first-child { border-radius: 8px 0 0 8px; }
.sp-qty-btn:last-child { border-radius: 0 8px 8px 0; }
.sp-qty-btn:hover { background: #f1f5f9; }
.sp-qty-num { min-width: 48px; height: 36px; line-height: 36px; text-align: center; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; font-size: 15px; font-weight: 600; color: #0f172a; }
.mp-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all .15s; }
.mp-item:hover { border-color: var(--primary); background: #f5f7ff; }
.sp-member { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; background: #f8fafc; font-size: 14px; }
.sp-member-remove { cursor: pointer; color: #94a3b8; font-size: 18px; line-height: 1; padding: 0 2px; }
.sp-member-remove:hover { color: #ef4444; }
/* 收银台折扣加减按钮 */
.disc-btn { width: 28px; height: 28px; border: 1px solid #e2e8f0; background: #fff; border-radius: 6px; font-size: 16px; line-height: 1; color: #334155; cursor: pointer; }
.disc-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.disc-btn:active { background: #e2e8f0; }
.no-spin::-webkit-outer-spin-button, .no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.no-spin { -moz-appearance: textfield; appearance: textfield; }
.ci-rate { font-size: 11px; padding: 1px 6px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
/* 全局隐藏数字输入框原生上下小箭头 */
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
/* 通用左右加减步进器 */
.num-stepper { display: inline-flex; align-items: center; gap: 4px; }
.num-btn { width: 26px; height: 28px; border: 1px solid #e2e8f0; background: #fff; border-radius: 6px; font-size: 15px; line-height: 1; color: #334155; cursor: pointer; padding: 0; flex: 0 0 auto; }
.num-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.num-btn:active { background: #e2e8f0; }
/* ========== 页面设置：浅色侧边栏 ========== */
body.sidebar-light .sidebar { background: #ffffff; color: #1e293b; box-shadow: 2px 0 16px rgba(0,0,0,0.06); border-right: 1px solid var(--gray-200); }
body.sidebar-light .logo { border-bottom-color: var(--gray-200); }
body.sidebar-light .logo p { color: var(--gray-400) !important; }
body.sidebar-light .nav-item { color: var(--gray-600); }
body.sidebar-light .nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
body.sidebar-light .nav-item.active { color: #fff; }
body.sidebar-light .nav-item.active .icon { background: rgba(255,255,255,0.2); }
body.sidebar-light .sidebar-footer { border-top-color: var(--gray-200); }
body.sidebar-light .sidebar-footer label { color: var(--gray-500); }
body.sidebar-light .sidebar-footer select { background: #fff; color: var(--gray-800); border-color: var(--gray-300); }

/* ========== 页面设置页 ========== */
.theme-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.theme-swatch { width: 64px; cursor: pointer; text-align: center; }
.theme-swatch .swatch { width: 64px; height: 40px; border-radius: 8px; border: 3px solid transparent; box-shadow: 0 1px 4px rgba(0,0,0,0.12); transition: transform .15s; }
.theme-swatch:hover .swatch { transform: translateY(-2px); }
.theme-swatch.active .swatch { border-color: var(--gray-900); }
.theme-swatch .swatch-label { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.opt-group { display: flex; gap: 10px; flex-wrap: wrap; }
.opt-btn { padding: 8px 18px; border: 1px solid var(--gray-300); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--gray-600); }
.opt-btn:hover { border-color: var(--primary); color: var(--primary); }
.opt-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }
/* ========== 门头横幅 ========== */
.storefront-banner { display: flex; align-items: center; justify-content: center; gap: 14px; text-align: center; font-weight: 700; font-size: 24px; letter-spacing: 4px; padding: 16px 20px; margin-bottom: 16px; border-radius: var(--radius-md); }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-chip { width: 36px; height: 36px; border-radius: 8px; cursor: pointer; border: 3px solid transparent; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.color-chip.active { border-color: var(--gray-900); }
input[type="color"].color-picker { width: 48px; height: 36px; border: 1px solid var(--gray-300); border-radius: 8px; background: #fff; padding: 2px; cursor: pointer; }
/* 门头标题/Logo 悬停放大动画（快慢由内联 transition-duration 控制） */
/* 门头元素自由定位：偏移通过 CSS 变量 --tx/--ty 控制（拖动时实时更新） */
.banner-movable { display: inline-block; transform: translate(var(--tx, 0px), var(--ty, 0px)); }
.banner-anim-title, .banner-anim-logo { transition: transform 300ms ease; transform-origin: center center; will-change: transform; }
.banner-anim-title:hover, .banner-anim-logo:hover { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(1.18); }
.banner-drag-on .banner-movable { cursor: move; outline: 1px dashed rgba(255,255,255,0.55); outline-offset: 3px; }
/* 收银台弹窗：标题与关闭按钮叠放在门头横幅上 */
.cashier-banner-wrap { position: relative; margin-bottom: 12px; }
.cashier-banner-wrap #cashier-banner { margin-bottom: 0; }
.cashier-banner-title { position: absolute; left: 54px; top: 50%; transform: translateY(-50%); margin: 0; font-size: 40px; line-height: 1.1; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.45); z-index: 5; pointer-events: none; }
.cashier-banner-close { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 6; }
.cashier-banner-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.65); background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.25); transition: filter 0.2s ease, transform 0.2s ease; }
.cashier-banner-btn:hover { filter: brightness(1.15); transform: scale(1.05); }
.cashier-banner-btn .cb-close-icon { font-size: 13px; }

/* 商品规格弹窗放大 1.5 倍（不影响会员选择弹窗） */
.spec-picker-lg { max-width: 720px; padding: 27px 30px; }
.spec-picker-lg .sp-header { font-size: 22px; margin-bottom: 20px; }
.spec-picker-lg .sp-close { font-size: 33px; }
.spec-picker-lg .sp-name { font-size: 27px; }
.spec-picker-lg .sp-meta { font-size: 19px; margin-bottom: 22px; }
.spec-picker-lg .sp-row { margin-bottom: 18px; }
.spec-picker-lg .sp-label { font-size: 19px; min-width: 96px; }
.spec-picker-lg .sp-val { font-size: 21px; min-width: 96px; padding: 12px 21px; }
.spec-picker-lg .sp-qty-btn { width: 54px; height: 54px; font-size: 27px; }
.spec-picker-lg .sp-qty-num { min-width: 72px; height: 54px; line-height: 54px; font-size: 22px; }
.spec-picker-lg .sp-btns { margin-top: 26px; }
.spec-picker-lg .sp-btns .btn { font-size: 18px; padding: 12px 26px; }
/* 主页门头吸顶：下拉页面时门头保持固定在顶部（弹窗 z-index 1000 不受影响） */
.main-content > .storefront-banner { position: sticky; top: 0; z-index: 100; }
/* 侧边栏内容超高时：菜单区自身滚动，底部（分店切换/退出登录）常驻可见 */
.sidebar > ul { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.sidebar .sidebar-footer { flex-shrink: 0; }
/* ========== 手机工作台与底部标签栏（仅 ≤768px 显示） ========== */
#mobile-home, #mobile-tabbar { display: none !important; }
.m-tile { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 6px; text-align: center; cursor: pointer; transition: all 0.15s; }
.m-tile:active { background: #f1f5f9; }
.m-tile .m-icon { font-size: 30px; margin-bottom: 6px; }
.m-tile .m-label { font-size: 13px; color: #334155; }
@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 12px 12px 76px 12px; }
    #mobile-home { display: block !important; }
    #mobile-tabbar {
        display: flex !important;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        height: 62px;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
        z-index: 500;
    }
    .mt-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; margin: 0; padding: 6px 0; border-radius: 0; font-size: 12px; color: #64748b; cursor: pointer; }
    .mt-tab .icon { font-size: 20px; background: none; width: auto; height: auto; }
    .mt-tab.active { color: var(--primary); }
    .mt-tab.active .icon { background: none; }
    #mobile-grid { grid-template-columns: repeat(4, 1fr); }
}
/* ========== 手机：功能页面内容适配（≤768px，防溢出/显示不全） ========== */
@media (max-width: 768px) {
    .main-content { overflow-x: hidden; }
    /* 页面里的表格：自身横向滚动，不再撑破屏幕 */
    .page table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    /* 筛选栏/搜索栏自动换行 */
    .search-bar, .filter-bar { flex-wrap: wrap; }
    .search-bar > *, .filter-bar > * { max-width: 100%; }
    /* 统计卡片两列更紧凑 */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    /* 普通弹窗全宽适配 */
    .modal .modal-content { width: 94% !important; max-width: none !important; padding: 18px 14px !important; max-height: 88dvh !important; }
    .modal .modal-content h2 { font-size: 20px !important; }
    /* 长表单网格已单列；按钮与输入框不溢出 */
    .page input, .page select, .page textarea { max-width: 100%; }
    .page-header { flex-wrap: wrap; }
    /* 收银台单列时各面板宽度撑满 */
    .cashier-layout { width: 100%; }
}
/* ========== 手机：收银台弹窗内门头压缩为单行，避免撑爆弹窗 ========== */
@media (max-width: 768px) {
    .modal.cashier-modal .modal-content { padding: 12px !important; }
    .cashier-banner-wrap { margin-bottom: 8px; }
    .cashier-banner-wrap #cashier-banner {
        max-height: 56px !important;
        min-height: 44px !important;
        height: auto !important;
        overflow: hidden;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        gap: 8px !important;
    }
    .cashier-banner-wrap #cashier-banner img { display: none !important; }              /* 手机上隐藏 logo 腾出空间 */
    .cashier-banner-wrap #cashier-banner span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 44vw;
        font-size: 17px !important;                                                      /* 覆盖用户设置的大字号 */
        letter-spacing: 1px !important;
    }
    .cashier-banner-wrap .banner-movable { transform: none !important; }                 /* 手机上忽略拖动偏移，避免移出视野 */
    .cashier-banner-title { font-size: 18px !important; left: 10px; }
    .cashier-banner-close { right: 6px; }
    .cashier-banner-btn { padding: 6px 12px !important; font-size: 12px !important; }
    .cashier-layout { gap: 10px !important; }
    .cashier-panel h4 { font-size: 18px !important; }
}
/* 主页面门头手机上同样压缩为单行 */
@media (max-width: 768px) {
    .main-content > #storefront-banner {
        max-height: 56px !important;
        min-height: 44px !important;
        height: auto !important;
        overflow: hidden;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }
    .main-content > #storefront-banner img { display: none !important; }
    .main-content > #storefront-banner span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 44vw;
        font-size: 17px !important;
        letter-spacing: 1px !important;
    }
    .main-content > #storefront-banner .banner-movable { transform: none !important; }
}
/* 禁止浏览器强制暗色（页面为浅色设计，强制反色会导致文字不可见） */
html { color-scheme: light only; }
/* ========== 手机：购物车条目与结算区字号/布局回收 ========== */
@media (max-width: 768px) {
    .cashier-cart-item { flex-wrap: wrap; row-gap: 6px; padding: 8px; }
    .cashier-cart-item .ci-name { flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
    .cashier-cart-item .ci-qty button { width: 26px; height: 26px; font-size: 14px; }
    .cashier-cart-item .ci-qty span { min-width: 24px; font-size: 15px; }
    .cashier-cart-item .ci-stock { font-size: 11px !important; padding: 1px 6px !important; }
    .ci-price { width: auto !important; font-size: 15px !important; }
    .cashier-summary .cs-row { font-size: 15px !important; padding: 3px 0; }
    .cashier-summary .cs-row.total { font-size: 21px !important; }
    #cart-discount { width: 60px !important; font-size: 16px !important; padding: 4px !important; }
    #cart-discount-info { font-size: 14px !important; }
    .modal.cashier-modal label { font-size: 14px !important; }
    #cart-remark { font-size: 15px !important; padding: 6px 10px !important; }
    #cart-member-info { font-size: 13px !important; }
    .cashier-search-input { font-size: 14px !important; padding: 8px 12px !important; }
}
/* ========== 手机收银台：底部结算条 + 购物车/结账底部弹层（仅 ≤768px） ========== */
.mobile-cart-bar, #mobile-sheet-mask { display: none; }
@media (max-width: 768px) {
    /* 三栏面板重排：商品列表全屏；购物车/结算变成底部弹层 */
    .modal.cashier-modal .cashier-layout { display: block !important; position: relative; padding-bottom: 66px; }
    .modal.cashier-modal .cashier-layout > .cashier-panel:nth-child(2),
    .modal.cashier-modal .cashier-layout > .cashier-panel:nth-child(3) {
        display: none !important;
        position: fixed;
        left: 0; right: 0; bottom: 0; top: auto;
        max-height: 62dvh;
        margin: 0;
        z-index: 1002;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.3);
        overflow-y: auto;
        padding-bottom: 70px;
    }
    body.cart-open .modal.cashier-modal .cashier-layout > .cashier-panel:nth-child(2) { display: flex !important; flex-direction: column; }
    body.checkout-open .modal.cashier-modal .cashier-layout > .cashier-panel:nth-child(3) { display: flex !important; flex-direction: column; }
    /* 遮罩 */
    #mobile-sheet-mask {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,0.5);
        z-index: 1001;
    }
    /* 底部结算条 */
    .mobile-cart-bar {
        display: flex !important;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        height: 58px;
        background: #1e293b;
        color: #fff;
        align-items: center;
        z-index: 1003;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
    }
    .mcb-cart {
        position: relative;
        width: 56px;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        cursor: pointer;
    }
    #mcb-count {
        position: absolute;
        top: 6px;
        right: 8px;
        min-width: 18px;
        height: 18px;
        padding: 0 4px;
        border-radius: 9px;
        background: #ef4444;
        color: #fff;
        font-size: 11px;
        font-weight: 700;
        align-items: center;
        justify-content: center;
        line-height: 18px;
        text-align: center;
    }
    .mcb-total { flex: 1; padding-left: 4px; line-height: 1.2; }
    .mcb-total-label { font-size: 11px; color: #94a3b8; }
    #mobile-cart-total { font-size: 19px; font-weight: 700; color: #fff; }
    .mcb-btn {
        flex: 0 0 auto;
        height: 100%;
        border: none;
        color: #fff;
        font-size: 16px;
        font-weight: 700;
        cursor: pointer;
        padding: 0 22px;
    }
    .mcb-suspend { background: #f59e0b; }
    .mcb-checkout { background: #ef4444; }
}
/* 手机收银台弹窗全屏：商品面板撑满剩余高度，消除底部空白 */
@media (max-width: 768px) {
    .modal.cashier-modal .modal-content {
        display: flex;
        flex-direction: column;
        height: 100dvh;
        max-height: 100dvh !important;
        padding: 10px 12px 0 !important;
    }
    .modal.cashier-modal .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
    .cashier-banner-wrap { flex-shrink: 0; }
    .modal.cashier-modal .cashier-layout { flex: 1; min-height: 0; }
    .modal.cashier-modal .cashier-layout > .cashier-panel:first-child {
        height: 100% !important;
        max-height: none !important;
        display: flex !important;
        flex-direction: column;
        overflow-y: auto;
    }
}
/* ========== 手机：页面顶部标题栏（返回 + 页面名，仿收银软件二级页） ========== */
@media (max-width: 768px) {
    #mobile-topbar {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 44px;
        background: var(--primary);
        color: #fff;
        align-items: center;
        padding: 0 12px;
        z-index: 600;
    }
    #mobile-back { font-size: 16px; cursor: pointer; width: 56px; }
    #mobile-topbar-title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; margin-right: 56px; }
    .main-content { padding-top: 56px !important; }
    .main-content > #storefront-banner { top: 44px !important; }
    /* 弹窗表单：全宽单列，字段间距收紧 */
    .modal .modal-content .form-group { margin-bottom: 14px; }
    .modal .modal-content .form-group > input,
    .modal .modal-content .form-group > select,
    .modal .modal-content .form-group > textarea { width: 100% !important; font-size: 16px; }
    .modal .modal-content .form-row { grid-template-columns: 1fr !important; gap: 10px !important; }
}
/* ========== 手机：列表页头部按钮网格化 + 表格提示收窄 ========== */
@media (max-width: 768px) {
    .page-header {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        align-items: stretch;
    }
    .page-header h1 { display: none; }              /* 顶部标题栏已有页面名 */
    .page-header > span { grid-column: 1 / -1; text-align: center; margin: 0; }
    .page-header .btn { width: 100% !important; margin: 0 !important; font-size: 15px !important; padding: 10px 8px !important; }
    .search-bar { gap: 8px !important; margin-bottom: 12px !important; }
    .search-bar input { flex: 1 1 100% !important; }
    .search-bar select { flex: 1 1 100% !important; max-width: none !important; }
    #product-sort-hint, .page > p[style*="提示"] { font-size: 11px !important; margin: 6px 0 0 !important; }
    /* 表格外层留出滑动空间，避免贴边 */
    .page .data-table { margin-bottom: 20px; }
    .page-header + .search-bar + p + .data-table { border-radius: 8px; }
}
/* ========== 手机：弹窗表单改「左标签 右值」行式（仿收银软件修改商品页） ========== */
@media (max-width: 768px) {
    .modal .modal-content .form-group {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 11px 0;
        border-bottom: 1px solid #eef2f7;
        margin-bottom: 0 !important;
    }
    .modal .modal-content .form-group > label {
        margin: 0;
        font-size: 15px;
        color: #334155;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .modal .modal-content .form-group > input,
    .modal .modal-content .form-group > select {
        flex: 0 1 auto;
        width: auto !important;
        max-width: 58% !important;
        text-align: right;
        border: none !important;
        background: transparent !important;
        font-size: 16px !important;
        padding: 4px 0 !important;
        color: #0f172a;
    }
    .modal .modal-content .form-group > input[type="checkbox"] {
        flex: 0 0 auto;
        width: 22px !important;
        height: 22px;
        margin: 0 0 0 auto;
        accent-color: var(--primary, #4f46e5);
    }
    .modal .modal-content .form-group > textarea {
        flex: 1 1 100%;
        width: 100% !important;
        margin-top: 8px;
        border: 1px solid #e2e8f0 !important;
        background: #fff !important;
        font-size: 15px !important;
        padding: 8px 10px !important;
    }
    /* 复杂控件组（含子块/按钮/表格）不套行式，保持常规表单 */
    .modal .modal-content .form-group:has(> div),
    .modal .modal-content .form-group:has(> button),
    .modal .modal-content .form-group:has(> table),
    .modal .modal-content .form-group:has(> ul) {
        display: block !important;
        border-bottom: none;
        padding: 8px 0;
    }
    .modal .modal-content .form-group:has(> div) > input,
    .modal .modal-content .form-group:has(> div) > select,
    .modal .modal-content .form-group:has(> div) > textarea {
        width: 100% !important;
        max-width: 100% !important;
        text-align: left;
        border: 1px solid #e2e8f0 !important;
        background: #fff !important;
        padding: 9px 12px !important;
    }
}


/* ===== v142j6z：侧边栏可折叠 ===== */
body.sidebar-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-width)); }
body.sidebar-collapsed .main-content { margin-left: 0 !important; }
.sidebar-toggle {
    position: fixed;
    top: 50%;
    left: var(--sidebar-width);
    transform: translateY(-50%);
    z-index: 101;
    width: 26px;
    height: 46px;
    border: none;
    border-radius: 0 10px 10px 0;
    background: var(--gray-900);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: left 0.25s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}
.sidebar-toggle:hover { background: #334155; }
body.sidebar-collapsed .sidebar-toggle { left: 0; }
body.sidebar-light .sidebar-toggle { background: #1e293b; }
