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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding-bottom: 80px;
}

.invoice-card {
    background: #fff;
    max-width: 800px;
    margin: 0 auto;
}

/* 顶部彩色条纹 */
.color-stripe {
    display: flex;
    height: 8px;
}

.stripe-blue {
    flex: 1;
    background: #4285F4;
}

.stripe-red {
    flex: 1;
    background: #EA4335;
}

.stripe-yellow {
    flex: 1;
    background: #FBBC05;
}

.stripe-green {
    flex: 1;
    background: #34A853;
}

/* 头部 */
.header {
    display: flex;
    flex-direction: column;
    padding: 25px 30px 15px 30px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-left {
    flex: 1;
}

.brand-name {
    font-size: 32pt;
    /* 品牌名称 */
    font-weight: 500;
    letter-spacing: 3px;
    line-height: 1.3;
    position: relative;
}

.brand-blue {
    color: #4285F4;
    font-weight: 800;
}

.brand-space {
    display: inline-block;
    width: 15px;
}

/* 雀槽四色logo图片 */
.qc-logo {
    height: 1.2em;
    width: auto;
    vertical-align: baseline;
    margin-right: 5px;
}

/* 中文雀槽 - 谷歌四色 */
.char-que {
    color: #4285F4;
    /* 蓝色 */
}

.char-cao {
    color: #EA4335;
    /* 红色 */
}

/* ® 标志 - 右上角 */
.brand-reg {
    font-size: 0.35em;
    vertical-align: top;
    color: #4285F4;
    position: relative;
    top: -0.3em;
}

.letter-n {
    color: #4285F4;
}

.letter-e {
    color: #EA4335;
}

.letter-s {
    color: #FBBC05;
}

.letter-c {
    color: #4285F4;
}

.letter-s2 {
    color: #34A853;
}

.letter-i {
    color: #EA4335;
}

.letter-n2 {
    color: #FBBC05;
}

.letter-k {
    color: #4285F4;
}

.brand-sub {
    font-size: 11pt;
    /* 公司全称 - 第三行 */
    color: #666;
    margin-top: 8px;
}

.header-right {
    text-align: right;
}

.invoice-title {
    font-size: 24pt;
    /* 送货单标题 */
    font-weight: 700;
    color: #333;
    letter-spacing: 8px;
}

.invoice-meta {
    margin-top: 8px;
    font-size: 11pt;
    color: #888;
    line-height: 1.6;
}

/* 分割线 */
.divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0 30px;
}

/* 客户信息 */
.client-section {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding: 20px 30px;
}

.client-item {
    flex: 1;
}

.client-label {
    font-size: 9pt;
    /* 标签 9pt 小五号 */
    color: #888;
    margin-bottom: 10px;
}

.client-value {
    width: 100%;
    border: none;
    padding: 8px 0;
    font-size: 11pt;
    /* 客户信息 10.5-11pt */
    font-weight: 500;
    color: #333;
    background: transparent;
    outline: none;
    border-bottom: 1px solid transparent;
}

.client-value:focus {
    border-bottom: 1px solid #4285F4;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 150px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
}

.autocomplete-item:hover {
    background: #f5f5f5;
}

/* 表格容器（与上方收货名称严格对齐） */
.table-container {
    padding: 20px 30px;
    margin: 0;
}

/* 商品表格（浅色下画线样式） */
.goods-table {
    width: 100%;
    border-collapse: collapse;
    border: none;
}

.goods-table th,
.goods-table td {
    border: none;
    border-bottom: 1px solid #e0e0e0;
    padding: 20px 10px;
    /* 舒适的行高和留白 */
    text-align: left;
    line-height: 1.5;
    /* 行高 */
}

.goods-table th {
    background: #f8f9fa;
    font-size: 15pt;
    /* 表头 15pt 加粗 */
    font-weight: 700;
    color: #333;
}

.goods-table th.col-no {
    width: 5%;
    text-align: center;
}

.goods-table th.col-name {
    width: 30%;
}

.goods-table th.col-model {
    width: 12%;
}

.goods-table th.col-unit {
    width: 10%;
}

.goods-table th.col-qty {
    width: 10%;
}

.goods-table th.col-price {
    width: 12%;
}

.goods-table th.col-amount {
    width: 15%;
}

.goods-table td {
    font-size: 14pt;
    /* 表格内容 14pt */
    color: #333;
}

.goods-table td:first-child {
    text-align: center;
    color: #4285F4;
    font-weight: 600;
}

.cell-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    outline: none;
    font-size: 13pt;
    /* 表格内容 13pt */
    padding: 0;
    background: transparent;
    color: #333;
}

.cell-input:focus {
    background: #fffde7;
}

.cell-input.text-right {
    text-align: right;
}

/* 单位下拉选择框 */
.cell-select {
    width: 100%;
    border: none;
    outline: none;
    font-size: 13px;
    padding: 4px 0;
    background: transparent;
    color: #333;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.product-autocomplete {
    position: relative;
}

.product-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 120px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.product-list.show {
    display: block;
}

.amount-display {
    text-align: right;
    font-weight: 500;
}

/* 合计区域（配送方式 + 付款方式 + 金额 + 备注） */
.total-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 30px;
    background: #fafafa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.options-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.option-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    min-width: 60px;
}

.option-select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
}

.total-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 150px;
}

.total-label {
    font-size: 14px;
    color: #666;
}

.total-amount {
    font-size: 42px;
    font-weight: 600;
    color: #EA4335;
}

.remarks-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.remarks-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.remarks-input {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 120px;
}

/* 备注行（说明上方） */
.remarks-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

.remarks-input-wide {
    flex: 1;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

/* 签名区域 */
.signature-section {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 20px 30px;
}

.signature-item {
    flex-shrink: 0;
}

/* 送货单位右对齐 */
.signature-delivery-right {
    text-align: right;
}

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

/* 送货单位及经手人（同一行显示） */
.signature-label-inline {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.signature-value-inline {
    border: none;
    border-bottom: 1px solid #ddd;
    padding: 5px 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: transparent;
    outline: none;
    width: auto;
    min-width: 120px;
    text-align: left;
    white-space: nowrap;
}

.signature-value {
    width: 100%;
    border: none;
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: transparent;
    outline: none;
    text-align: right;
}

/* 收款码区域（底部居中） */
.qr-section-center {
    padding: 20px 30px;
    text-align: center;
}

.qr-payment-title-center {
    font-size: 12px;
    color: #888;
    margin-bottom: 15px;
    text-align: center;
}

.qr-row-center {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.qr-item-center {
    text-align: center;
}

.qr-box-center {
    width: 180px;
    height: 180px;
    border: 1px solid #ddd;
    padding: 10px;
    background: #fff;
    margin: 0 auto;
}

.qr-box-center img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-name-center {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
}

/* 底部说明 + 送货单位 并排 */
.footer-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 30px 30px;
    /* 增加边距 */
    font-size: 11pt;
    /* 放大 */
    line-height: 2.2;
}

.footer-left {
    flex: 1;
}

.footer-right {
    flex-shrink: 0;
    text-align: right;
    min-width: 120px;
}

.note-line {
    margin-bottom: 2px;
}

/* 收款码区域（最底部） */
.qr-section-bottom {
    padding: 15px 30px 25px 30px;
    text-align: center;
}

.note-blue {
    color: #4285F4;
    font-weight: 600;
}

.note-red {
    color: #EA4335;
    font-weight: 600;
}

.note-yellow {
    color: #FBBC05;
    font-weight: 600;
}

.note-green {
    color: #34A853;
    font-weight: 600;
}

.note-text {
    color: #333;
}

/* 操作栏 */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px 15px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 999;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.btn-undo {
    background: #FF9800;
    color: #fff;
}

.btn-add {
    background: #f0f0f0;
    color: #333;
}

.btn-share {
    background: linear-gradient(135deg, #4285F4, #34A853);
    color: #fff;
}

.btn-new {
    background: #333;
    color: #fff;
}

.btn-report {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
}

.btn-history {
    background: #9C27B0;
    color: #fff;
}

.btn-more {
    background: linear-gradient(135deg, #607D8B, #455A64);
    color: #fff;
}

/* 更多菜单 */
.more-menu-wrapper {
    position: relative;
    display: inline-block;
}

.more-menu {
    display: none;
    position: fixed;
    bottom: 70px;
    right: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 160px;
    overflow: hidden;
    z-index: 9999;
}

.more-menu.show {
    display: block;
}

.more-menu-item {
    padding: 14px 18px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
}

.more-menu-item:hover {
    background: #f5f5f5;
}

.more-menu-item:active {
    background: #e0e0e0;
}

/* 输入框文字换行 */
.cell-input,
.client-value,
.remarks-input,
.remarks-input-wide {
    word-wrap: break-word;
    word-break: break-all;
    white-space: pre-wrap;
}

.btn:active {
    transform: scale(0.95);
}

/* 历史记录弹窗 */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-content {
    background: #fff;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4285F4, #9C27B0);
    color: #fff;
}

.history-header h3 {
    margin: 0;
    font-size: 18px;
}

.history-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.history-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: #e3f2fd;
}

.history-item-info {
    flex: 1;
}

.history-item-name {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.history-item-date {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.history-item-amount {
    font-weight: 700;
    color: #EA4335;
    font-size: 16px;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.history-item-actions {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.history-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.history-btn-load {
    background: #4285F4;
    color: #fff;
}

.history-btn-delete {
    background: #EA4335;
    color: #fff;
}

/* 响应式 - 手机适配（保持原布局不变） */
@media (max-width: 600px) {
    .invoice-card {
        padding: 0;
    }

    .header {
        padding: 15px 20px;
    }

    .brand-name {
        font-size: 40pt;
        /* 保持大字体 */
    }

    .invoice-title {
        font-size: 24pt;
        letter-spacing: 6px;
    }

    .client-section {
        padding: 15px 20px;
        gap: 15px;
    }

    .client-value {
        font-size: 14px;
    }

    /* 表格容器与客户信息对齐 */
    .table-container {
        padding: 15px 20px;
        margin: 0;
    }

    .goods-table {
        width: 100%;
        margin: 0;
    }

    .goods-table th,
    .goods-table td {
        padding: 16px 5px;
        /* 舒适留白 */
        font-size: 12pt;
        /* 保持12pt，不小于10.5pt */
        line-height: 1.5;
    }

    .total-section {
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 12px 15px;
        gap: 10px;
        align-items: center;
        overflow-x: auto;
    }

    .options-column {
        flex-shrink: 0;
    }

    .option-label {
        font-size: 12px;
        min-width: 50px;
    }

    .option-select {
        padding: 5px 8px;
        font-size: 12px;
    }

    .total-center {
        flex-shrink: 0;
        min-width: 100px;
    }

    .total-amount {
        font-size: 32px;
    }

    .remarks-section {
        flex-shrink: 0;
    }

    .remarks-label {
        font-size: 12px;
    }

    .remarks-input {
        width: 80px;
        font-size: 12px;
    }

    /* 底部说明 + 送货单位 移动端 */
    .footer-section {
        flex-direction: column;
        gap: 15px;
        padding: 20px 20px;
        font-size: 11pt;
        /* 底部说明 11pt */
        line-height: 1.8;
    }

    .footer-right {
        text-align: left;
        min-width: auto;
    }

    /* 收款码区域移动端 */
    .qr-section-bottom {
        padding: 15px 20px 20px 20px;
    }

    .qr-row-center {
        gap: 15px;
    }

    .qr-box-center {
        width: 150px;
        /* 放大 */
        height: 150px;
    }

    .divider {
        margin: 0 20px;
    }
}

/* AI 弹窗样式 */
.ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.ai-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4285F4, #9333EA);
    color: #fff;
}

.ai-header h3 {
    margin: 0;
    font-size: 18px;
}

.ai-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.ai-hint {
    padding: 15px 20px 10px;
    color: #666;
    font-size: 14px;
}

.ai-content textarea {
    width: calc(100% - 40px);
    margin: 0 20px;
    height: 150px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    resize: none;
}

.ai-buttons {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
}

.btn-ai-parse {
    flex: 1;
    background: linear-gradient(135deg, #4285F4, #9333EA);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

.btn-ai-image {
    flex: 1;
    background: #34A853;
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
}

.ai-loading {
    text-align: center;
    padding: 20px;
}

.ai-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ddd;
    border-top-color: #4285F4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* AI和语音按钮 */
.btn-ai {
    background: linear-gradient(135deg, #9333EA, #4285F4);
    color: #fff;
}

.btn-voice {
    background: #4285F4;
    color: #fff;
}

.btn-voice.listening {
    background: #EA4335;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}