/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 16px;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ==================== 页面容器 ==================== */
.page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px;
    background: #f5f5f5;
    flex-direction: column;
}

.page.active {
    display: flex;
}

/* ==================== 顶部标题栏 ==================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
    min-height: 52px;
    background: #1a73e8;
    color: white;
    padding: 0 12px;
    position: relative;
    z-index: 10;
}

.page-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    padding: 6px 10px;
    cursor: pointer;
}

.back-btn {
    position: absolute;
    left: 8px;
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    padding: 6px 10px;
    cursor: pointer;
}

/* ==================== 页面内容区 ==================== */
.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

/* ==================== 底部导航栏 ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: white;
    display: flex;
    border-top: 1px solid #e0e0e0;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
    padding: 4px 0;
}

.nav-item.active {
    color: #1a73e8;
}

.nav-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 11px;
    line-height: 1;
}

/* ==================== 首页统计卡片 ==================== */
.home-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: white;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.stat-card-warn {
    background: #fff3e0;
}

.stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1a73e8;
}

.stat-card-warn .stat-value {
    color: #e65100;
}

.stat-unit {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}
/* ==================== 通用列表和搜索 ==================== */
.list-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.empty-tip {
    text-align: center;
    color: #aaa;
    padding: 40px 20px;
    font-size: 14px;
}

.search-bar {
    margin-bottom: 12px;
}

.search-bar input {
    width: 100%;
    height: 42px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 15px;
    background: white;
    outline: none;
}

.search-bar input:focus {
    border-color: #1a73e8;
}

/* ==================== 订单列表项 ==================== */
.order-list .order-item {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.order-list .order-item:last-child {
    border-bottom: none;
}

.order-item .order-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.order-item .order-customer {
    font-size: 16px;
    font-weight: 600;
}

.order-item .order-amount {
    font-size: 18px;
    font-weight: 700;
    color: #1a73e8;
}

.order-item .order-info {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
}

.order-item .order-status {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

.order-status.settled {
    background: #e8f5e9;
    color: #2e7d32;
}

.order-status.unsettled {
    background: #fff3e0;
    color: #e65100;
}

/* ==================== 客户列表项 ==================== */
.customer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.customer-item:last-child {
    border-bottom: none;
}

.customer-name {
    font-size: 16px;
    font-weight: 600;
}

.customer-phone {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.customer-debt {
    font-size: 16px;
    font-weight: 600;
    color: #e65100;
    white-space: nowrap;
}

/* ==================== 表单样式 ==================== */
.form-section {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.required {
    color: #e53935;
    font-size: 13px;
    font-weight: 400;
    margin-left: 4px;
}

.form-input {
    width: 100%;
    height: 44px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 16px;
    background: white;
    outline: none;
}

.form-input:focus {
    border-color: #1a73e8;
}

.form-select {
    width: 100%;
    height: 44px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 16px;
    background: white;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.row-flex {
    display: flex;
    gap: 10px;
    align-items: center;
}

.row-flex .form-select {
    flex: 1;
}
/* ==================== 按钮样式 ==================== */
.btn-primary {
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
}

.btn-primary:active {
    background: #1557b0;
}

.btn-secondary {
    background: white;
    color: #1a73e8;
    border: 1px solid #1a73e8;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    cursor: pointer;
    min-height: 44px;
}

.btn-small {
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-add-item {
    width: 100%;
    background: #f0f7ff;
    color: #1a73e8;
    border: 1px dashed #1a73e8;
    border-radius: 8px;
    padding: 12px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 10px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-bottom: 20px;
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    flex: 1;
}

/* ==================== 收银台商品行 ==================== */
.cashier-item-row {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.cashier-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cashier-item-top select {
    flex: 1;
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 15px;
    background: white;
}

.cashier-item-top .remove-item {
    background: none;
    border: none;
    color: #e53935;
    font-size: 20px;
    padding: 4px 8px;
    cursor: pointer;
    margin-left: 8px;
}

.cashier-item-detail {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cashier-item-detail input {
    width: 70px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 14px;
    text-align: center;
    background: white;
}

.cashier-item-detail .item-subtotal {
    font-size: 15px;
    font-weight: 600;
    color: #1a73e8;
    white-space: nowrap;
    margin-left: auto;
}

/* ==================== 总金额栏 ==================== */
.total-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.total-label {
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

.total-amount {
    font-size: 24px;
    font-weight: 700;
    color: #e53935;
}

/* ==================== 开关样式 ==================== */
.status-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-text-left, .status-text-right {
    font-size: 15px;
    color: #666;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 28px;
    transition: 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background: #4caf50;
}

input:checked + .slider:before {
    transform: translateX(22px);
}
/* ==================== 地址标签 ==================== */
.address-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.address-tag {
    background: #e8f0fe;
    color: #1a73e8;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
}

.address-tag.selected {
    border-color: #1a73e8;
    background: #c8ddf8;
}

/* ==================== 聊天界面 ==================== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.chat-welcome {
    text-align: center;
    color: #888;
    padding: 40px 20px;
    font-size: 14px;
    line-height: 2;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.6;
    word-break: break-all;
}

.chat-bubble.user {
    background: #1a73e8;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.chat-bubble.system {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-time {
    text-align: center;
    font-size: 12px;
    color: #aaa;
    margin: 10px 0;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    min-height: 56px;
}

.chat-input-area input {
    flex: 1;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 0 16px;
    font-size: 15px;
    outline: none;
}

.chat-input-area .btn-primary {
    border-radius: 20px;
    padding: 0 20px;
    min-height: 40px;
}

/* ==================== 弹窗 ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 14px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

.modal-body {
    padding: 20px;
}

.modal-body .form-section {
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    justify-content: flex-end;
}

.confirm-message {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    text-align: center;
}

/* ==================== 提示消息 ==================== */
.toast {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    z-index: 300;
    text-align: center;
    max-width: 80%;
}

.toast.show {
    display: block;
}

/* ==================== 系统管理菜单 ==================== */
.settings-menu {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:active {
    background: #f5f5f5;
}

.menu-icon {
    font-size: 20px;
    margin-right: 14px;
}

.menu-text {
    flex: 1;
    font-size: 16px;
}

.menu-arrow {
    font-size: 20px;
    color: #ccc;
}

.menu-item-danger .menu-text {
    color: #e53935;
}
/* ==================== 产品列表项 ==================== */
.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
}

.product-item:last-child {
    border-bottom: none;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
}

.product-info {
    font-size: 13px;
    color: #888;
    margin-top: 2px;
}

.product-actions {
    display: flex;
    gap: 8px;
}

.product-actions button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #666;
}

.product-actions .btn-delete {
    color: #e53935;
    border-color: #e53935;
}

/* ==================== 报表 ==================== */
.report-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    background: #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    color: #666;
}

.tab-btn.active {
    background: #1a73e8;
    color: white;
}

.report-filter {
    margin-bottom: 14px;
}

.custom-dates {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}

.custom-dates .form-input {
    flex: 1;
    height: 38px;
    font-size: 14px;
}

.report-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.report-export {
    margin-top: 16px;
    text-align: center;
}

/* ==================== 客户详情页 ==================== */
.detail-section {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.detail-section-title {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    font-weight: 600;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 15px;
}

.detail-row .label {
    color: #888;
}

.detail-row .value {
    font-weight: 600;
    color: #333;
}

.detail-row .value.debt {
    color: #e65100;
}
