.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.form-group {
    margin: 15px 0;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
}

button {
    padding: 5px 10px;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
}

.bill-item {
    display: flex;
    justify-content: space-between;
    padding: 5px;
    border-bottom: 1px solid #ddd;
}

.total {
    margin-top: 20px;
    font-weight: bold;
}

.bill-items-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
}

.bill-items-table th, .bill-items-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.summary {
    margin-top: 20px;
    border-top: 2px solid #ddd;
    padding-top: 20px;
}

.totals {
    margin-left: auto;
    width: 300px;
}

.print-button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
}

.logo-upload {
    margin-bottom: 20px;
}

.document-header {
    border-bottom: 2px solid #000;
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.company-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    text-align: left;
    padding: 10px 0;
    margin-left: 15mm; /* เพิ่มระยะห่างจากขอบซ้าย 1.5 ซม. */
}

.payment-details {
    border: 1px solid #ddd;
    padding: 15px;
    margin: 20px 0;
    background-color: #f9f9f9;
}

.terms-conditions {
    font-size: 0.9em;
    margin: 20px 0;
    padding: 15px;
    background-color: #f5f5f5;
}

.signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.signature-box {
    text-align: center;
}

.signature-line {
    border-top: 1px solid #000;
    margin-top: 50px;
    padding-top: 10px;
}

.bill-items-table th {
    background-color: #f0f0f0;
}

.amount-in-words {
    font-style: italic;
    margin: 15px 0;
    color: #666;
}

.company-logo {
    max-width: 200px;
    height: auto;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.summary-table td {
    padding: 8px;
    border: 1px solid #ddd;
}

.summary-table tr:last-child {
    font-weight: bold;
    background-color: #f8f9fa;
}

.grand-total {
    font-size: 1.2em;
    background-color: #e9ecef;
}

.tax-section {
    background-color: #f8f9fa;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.tax-section input {
    width: 100px;
    margin-right: 20px;
}

.tax-section label {
    margin-right: 10px;
    font-weight: bold;
}

.bill-footer {
    margin-top: 30px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.payment-info {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.notes {
    font-size: 0.9em;
    color: #666;
}

.notes ul {
    list-style-type: none;
    padding-left: 0;
}

.notes li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.notes li::before {
    content: "*";
    position: absolute;
    left: 0;
}

.contact-info {
    margin: 15px 0;
    font-style: italic;
}

.pdf-bill {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Sarabun', sans-serif;
    background: white;
}

.pdf-bill table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.pdf-bill th,
.pdf-bill td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.pdf-bill th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.pdf-bill .summary-table tr:last-child {
    background-color: #f8f9fa;
    font-weight: bold;
}

.pdf-bill .header {
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.save-button {
    background-color: #28a745;
}

.print-button {
    background-color: #007bff;
}

.cancel-button {
    background-color: #dc3545;
}

.preview-actions button {
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    transition: opacity 0.2s;
}

.preview-actions button:hover {
    opacity: 0.9;
}

.bill-container {
    padding: 20px;
    background: white;
}

.document-info {
    text-align: center;
    margin: 20px 0;
}

.document-info h2 {
    margin-bottom: 10px;
}

.customer-info {
    margin: 20px 0;
}

.notes {
    margin-top: 30px;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.notes ul {
    padding-left: 20px;
}

.notes li {
    margin: 10px 0;
    position: relative;
}

.signatures {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
    page-break-inside: avoid;
}

.signature-line {
    width: 200px;
    border-bottom: 1px solid #000;
    margin: 0 auto 10px;
}

/* ปรับแต่งตารางรายการสินค้า */
.bill-items-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bill-items-table th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border: 1px solid #dee2e6;
}

.bill-items-table td {
    padding: 12px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.bill-items-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.bill-items-table tr:hover {
    background-color: #f2f2f2;
}

/* จัดการความกว้างคอลัมน์ */
.bill-items-table th:nth-child(1), /* รายการ */
.bill-items-table td:nth-child(1) {
    width: 20%;
}

.bill-items-table th:nth-child(2), /* คำอธิบาย */
.bill-items-table td:nth-child(2) {
    width: 30%;
}

.bill-items-table th:nth-child(3), /* จำนวน */
.bill-items-table td:nth-child(3) {
    width: 10%;
    text-align: right;
}

.bill-items-table th:nth-child(4), /* ราคาต่อหน่วย */
.bill-items-table td:nth-child(4) {
    width: 15%;
    text-align: right;
}

.bill-items-table th:nth-child(5), /* ส่วนลด */
.bill-items-table td:nth-child(5) {
    width: 10%;
    text-align: right;
}

.bill-items-table th:nth-child(6), /* ราคารวม */
.bill-items-table td:nth-child(6) {
    width: 15%;
    text-align: right;
    font-weight: bold;
}

/* ตารางสรุปยอด */
.summary-table {
    width: 300px !important;
    margin-left: auto !important;
    margin-top: 20px;
    border: 1px solid #dee2e6;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.summary-table td {
    padding: 10px;
    border: 1px solid #dee2e6;
}

.summary-table td:first-child {
    width: 60%;
}

.summary-table td:last-child {
    width: 40%;
    text-align: right;
    font-weight: bold;
}

.summary-table tr.grand-total {
    background-color: #f8f9fa;
    font-size: 1.1em;
    color: #28a745;
}

/* สไตล์สำหรับใบเสร็จ */
.bill-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* แก้ไขส่วนหัวใบเสร็จ */
.bill-header {
    display: grid;
    grid-template-columns: 200px 1fr; /* แบ่งเป็น 2 คอลัมน์ */
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
    width: 100%;
}

.logo-container {
    text-align: center;
}

.company-logo {
    max-width: 180px;
    max-height: 180px;
    height: auto;
    object-fit: contain;
    margin: 0;
}

.company-details {
    text-align: left;
    padding: 10px 0;
    margin-left: 15mm; /* เพิ่มระยะห่างจากขอบซ้าย 1.5 ซม. */
}

.company-details h2 {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 15px 0;
    color: #333;
}

.company-details p {
    margin: 5px 0;
    line-height: 1.6;
    font-size: 16px;
}

/* ยกเลิก margin ของ br เดิม */
.company-details br {
    display: none;
}

@media print {
    .bill-header {
        grid-template-columns: 200px 1fr;
    }
}

/* ตารางรายการสินค้า */
.bill-items-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
}

.bill-items-table th {
    background: #f8f9fa;
    color: #333;
    font-weight: bold;
    text-align: center;
    padding: 12px;
    border: 1px solid #dee2e6;
}

.bill-items-table td {
    padding: 10px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.bill-items-table tr:nth-child(even) {
    background: #f8f9fa;
}

/* กำหนดความกว้างคอลัมน์ */
.bill-items-table .col-item { width: 25%; }
.bill-items-table .col-desc { width: 30%; }
.bill-items-table .col-qty { width: 10%; text-align: right; }
.bill-items-table .col-price { width: 15%; text-align: right; }
.bill-items-table .col-discount { width: 10%; text-align: right; }
.bill-items-table .col-total { width: 15%; text-align: right; }

/* สรุปยอดเงิน */
.summary-section {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.amount-in-words {
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table tr td:first-child {
    text-align: right;
    padding-right: 15px;
    width: 60%;
}

.summary-table tr td:last-child {
    text-align: right;
    width: 40%;
    font-weight: bold;
}

.summary-table .grand-total {
    font-size: 1.2em;
    color: #28a745;
    background: #f8f9fa;
}

/* ส่วนท้ายใบเสร็จ */
.bill-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.payment-info {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.signatures {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    margin-top: 40px;
}

.signature-box {
    text-align: center;
}

.signature-line {
    width: 80%;
    margin: 40px auto 10px;
    border-bottom: 1px solid #333;
}

/* ตารางข้อมูลทั่วไป */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.info-table td {
    padding: 10px;
    border: 1px solid #dee2e6;
}

.info-header {
    background: #f8f9fa;
    font-weight: bold;
    color: #495057;
    text-align: center;
    font-size: 1.1em;
}

.info-label {
    width: 150px;
    background: #f8f9fa;
    font-weight: bold;
}

.info-value {
    padding-left: 15px;
}

/* ตารางรายการสินค้า */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.items-table th {
    background: #f8f9fa;
    color: #495057;
    font-weight: bold;
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
}

.items-table td {
    padding: 10px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

.items-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.items-table tbody tr:hover {
    background: #f2f2f2;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* ขนาดคอลัมน์ตารางรายการ */
.items-table th:nth-child(1) { width: 5%; }  /* ลำดับ */
.items-table th:nth-child(2) { width: 20%; } /* รายการ */
.items-table th:nth-child(3) { width: 25%; } /* คำอธิบาย */
.items-table th:nth-child(4) { width: 10%; } /* จำนวน */
.items-table th:nth-child(5) { width: 15%; } /* ราคาต่อหน่วย */
.items-table th:nth-child(6) { width: 10%; } /* ส่วนลด */
.items-table th:nth-child(7) { width: 15%; } /* ราคารวม */

/* ...existing code... */

.notice-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.notice-list li {
    position: relative;
    padding: 8px 0 8px 20px;
    border-bottom: 1px dashed #dee2e6;
}

.notice-list li:last-child {
    border-bottom: none;
}

.notice-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #666;
}

.contact-info {
    padding: 15px;
    line-height: 1.6;
    background: #f8f9fa;
}

/* ...existing code... */

.form-group input[type="text"]#logoUrl {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.company-logo {
    max-width: 180px;
    max-height: 180px;
    height: auto;
    object-fit: contain;
}

/* ...rest of existing code... */

/* แก้ไขส่วนหัวใบเสร็จ */
.bill-header {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.company-details {
    text-align: left;
}

.company-name {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    text-align: left;
}

.company-address {
    font-size: 16px;
    line-height: 1.6;
    margin: 5px 0;
}

/* ยกเลิก styles ที่ไม่จำเป็น */
.company-details br {
    display: none;
}

/* ...rest of existing code... */

/* ...existing code... */

/* แก้ไข styles สำหรับ preview */
.bill-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    align-items: start;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

.logo-container {
    width: 200px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.company-logo {
    max-width: 180px;
    height: auto;
    object-fit: contain;
}

.company-details {
    text-align: left;
    padding: 0;
}

.company-details h2 {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 0 0 15px 0;
}

.company-details div {
    font-size: 16px;
    line-height: 1.6;
}

/* ...rest of existing code... */

/* ...existing code... */

.company-name {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    text-align: left;
}

.company-info-details {
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    text-align: left;
}

.company-info-details p {
    margin: 5px 0;
}

/* ...rest of existing code... */

/* ...existing code... */

.company-name {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0;
    text-align: left;
}

.company-address {
    font-size: 16px;
    color: #333;
    text-align: left;
}

.bill-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
    margin-bottom: 20px;
}

.logo-container {
    width: 200px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.company-logo {
    max-width: 180px;
    height: auto;
    object-fit: contain;
}

.company-details {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 0;
}

/* ...rest of existing code... */

/* ...existing code... */

/* ปรับปรุงส่วนสรุปยอดเงิน */
.summary-section {
    width: 100%;
    margin-top: 20px;
}

.amount-in-words {
    width: 100%;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 16px;
    text-align: left;
}

.summary-table {
    width: 100% !important;
    margin: 10px 0 !important;
    border: 1px solid #dee2e6;
}

.summary-table tr td:first-child {
    width: 70%;
    text-align: right;
    padding-right: 15px;
    font-weight: normal;
}

.summary-table tr td:last-child {
    width: 30%;
    text-align: right;
    padding: 8px 15px;
    font-weight: bold;
}

.summary-table tr.grand-total {
    background-color: #f8f9fa;
    font-size: 1.1em;
}

.summary-table tr.grand-total td {
    font-weight: bold;
    color: #28a745;
    border-top: 2px solid #dee2e6;
}

.summary-table tr td {
    border: 1px solid #dee2e6;
}

/* ...rest of existing code... */

/* ...existing code... */

.summary-section {
    width: 100%;
    margin-top: 20px;
}

.summary-table {
    width: 100% !important;
    margin: 10px 0 !important;
    border: 1px solid #dee2e6;
    border-collapse: collapse;
}

.summary-table tr td {
    padding: 8px 15px;
    border: 1px solid #dee2e6;
}

.summary-table tr td:first-child {
    width: 70%;
    text-align: right !important;
}

.summary-table tr td:last-child {
    width: 30%;
    text-align: right !important;
    font-weight: bold;
}

.summary-table tr.grand-total td {
    background-color: #f8f9fa;
    font-weight: bold;
    border-top: 2px solid #dee2e6;
}

/* ...rest of existing code... */

/* ...existing code... */

.summary-table {
    width: 100% !important;
    border-collapse: collapse;
    margin-top: 20px;
    margin-left: auto !important;
}

.summary-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.amount-in-words {
    width: 100%;
    text-align: left;
    margin-bottom: 10px;
}

.totals {
    width: 400px !important; /* เพิ่มความกว้างให้มากขึ้น */
    margin-left: auto !important;
}

.summary-table tr td:first-child {
    width: 70%;
    text-align: right !important;
    padding-right: 15px;
}

.summary-table tr td:last-child {
    width: 30%;
    text-align: right !important;
    padding-left: 15px;
}

/* ...rest of existing code... */

/* ...existing code... */

.summary-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 15mm; /* เพิ่มระยะห่างจากขอบขวา */
}

.totals {
    width: 400px !important;
    margin-right: auto !important;
    margin-left: 15mm !important; /* เพิ่มระยะจากขอบซ้าย 1.5 ซม. */
}

.summary-table {
    width: 100% !important;
    border-collapse: collapse;
    margin-top: 10px;
}

.summary-table tr td:first-child {
    width: 65%;
    text-align: right !important;
    padding-right: 15px;
}

.summary-table tr td:last-child {
    width: 35%;
    text-align: right !important;
    padding-right: 35px; /* เพิ่มระยะห่างของตัวเลขจากขอบขวา */
}

/* ...rest of existing code... */

/* ...existing code... */

.amount-in-words {
    width: calc(100% - 25mm) !important; /* ปรับความกว้างให้สอดคล้องกับ margin-left */
    margin-left: 25mm !important; /* เพิ่มระยะห่างจากขอบซ้าย 2.5 ซม. */
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    text-align: left;
}

/* ...rest of existing code... */

/* เพิ่ม style สำหรับปุ่มลบ */
.delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.delete-btn:hover {
    background-color: #c82333;
}

/* ปรับแต่งเพิ่มเติมสำหรับคอลัมน์ action */
.col-action {
    width: 50px !important;
}

.text-center {
    text-align: center !important;
}

/* ...existing code... */

.pdf-bill {
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Sarabun', sans-serif;
    background: white;
}

.company-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.company-address p {
    margin: 5px 0;
    line-height: 1.5;
}

.doc-title {
    text-align: center;
    margin: 20px 0;
}

.doc-title h2 {
    font-size: 20px;
    font-weight: bold;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.info-table td {
    padding: 8px;
    border: 1px solid #ddd;
}

.info-header {
    background: #f8f9fa;
    font-weight: bold;
    text-align: center;
}

.info-label {
    width: 150px;
    background: #f8f9fa;
}

.notice-list {
    list-style-type: disc;
    margin: 0;
    padding-left: 20px;
}

.notice-list li {
    margin: 5px 0;
}

/* ...rest of existing code... */

/* ...existing code... */

/* แก้ไข style สำหรับ modal และ preview */
.modal-content {
    width: 95% !important;
    max-width: 1200px !important;
    margin: 2% auto !important;
    padding: 30px !important;
    background: white !important;
}

#previewContent {
    padding: 20px;
    background: white;
    font-family: 'Sarabun', sans-serif;
}

.pdf-bill {
    width: 100%;
    max-width: 210mm;
    margin: 0 auto;
    padding: 20px;
    background: white;
}

/* ปรับขนาดตารางและตัวอักษร */
.items-table {
    width: 100% !important;
    margin: 20px 0 !important;
    border-collapse: collapse !important;
}

.items-table th,
.items-table td {
    padding: 8px !important;
    border: 1px solid #dee2e6 !important;
    font-size: 14px !important;
}

.summary-section {
    margin: 20px 0 !important;
    width: 100% !important;
}

.summary-table {
    width: 60% !important;
    margin-left: auto !important;
    border-collapse: collapse !important;
}

/* ...rest of existing code... */

/* ...existing code... */

.pdf-bill {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Sarabun', sans-serif;
    background: white;
}

.bill-header {
    margin-bottom: 30px;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
}

.company-details h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.company-details p {
    margin: 5px 0;
    font-size: 16px;
}

.document-info {
    text-align: center;
    margin: 20px 0;
}

.customer-info {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.items-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
}

.summary-section {
    margin: 30px 0;
}

.payment-section,
.contact-section {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

/* ...rest of existing code... */

/* ...existing code... */

/* ปรับปรุงตารางในใบเสร็จ */
.pdf-bill table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pdf-bill th {
    background: #f8f9fa;
    color: #333;
    font-weight: bold;
    padding: 12px;
    border: 1px solid #dee2e6;
    text-align: center;
    font-size: 14px;
}

.pdf-bill td {
    padding: 12px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
    font-size: 14px;
}

/* จัดการความกว้างคอลัมน์ตารางรายการสินค้า */
.items-table {
    margin: 20px 0 !important;
}

.items-table th:nth-child(1) { width: 5%; }  /* ลำดับ */
.items-table th:nth-child(2) { width: 20%; } /* รายการ */
.items-table th:nth-child(3) { width: 30%; } /* คำอธิบาย */
.items-table th:nth-child(4) { width: 10%; text-align: right; } /* จำนวน */
.items-table th:nth-child(5) { width: 15%; text-align: right; } /* ราคา */
.items-table th:nth-child(6) { width: 8%; text-align: right; }  /* ส่วนลด */
.items-table th:nth-child(7) { width: 12%; text-align: right; } /* รวม */

.items-table td.text-right {
    text-align: right;
    padding-right: 15px;
}

/* ตารางสรุปยอด */
.summary-table {
    width: 60% !important;
    margin-left: auto !important;
    margin-top: 20px !important;
}

.summary-table td {
    padding: 10px 15px;
}

.summary-table td:first-child {
    text-align: right;
    width: 70%;
}

.summary-table td:last-child {
    text-align: right;
    width: 30%;
    font-weight: bold;
}

.summary-table tr.grand-total {
    background: #f8f9fa;
    font-size: 1.1em;
    color: #28a745;
}

/* ตารางข้อมูลลูกค้าและเอกสาร */
.info-table {
    margin: 15px 0;
}

.info-table .info-header {
    background: #f8f9fa;
    font-weight: bold;
    text-align: center;
    padding: 12px;
    border: 1px solid #dee2e6;
    font-size: 16px;
}

.info-table .info-label {
    width: 150px;
    background: #f8f9fa;
    font-weight: bold;
}

.info-table .info-value {
    padding-left: 20px;
}

/* เส้นขอบและพื้นหลังสลับสี */
.items-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.items-table tr:hover {
    background-color: #f5f5f5;
}

/* ...rest of existing code... */

/* ...existing code... */

/* เพิ่ม styles สำหรับ contact และ payment container */
.footer-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.contact-container,
.payment-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    height: 100%;
}

.contact-container h4,
.payment-container h4 {
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.info-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.info-label {
    font-weight: bold;
    color: #495057;
}

.info-value {
    color: #333;
}

/* ...rest of existing code... */

/* ...existing code... */

/* ปรับปรุง footer container */
.footer-info-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
    width: 100%;
}

.contact-box,
.payment-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    height: 100%;
}

.box-header {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.box-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 15px;
    align-items: baseline;
}

.box-label {
    font-weight: bold;
    color: #495057;
    white-space: nowrap;
}

.box-value {
    color: #333;
}

/* ...rest of existing code... */

/* ...existing code... */

/* เพิ่ม styles สำหรับ footer containers */
.footer-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.info-box {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 20px;
    height: 100%;
}

.info-box h3 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    font-size: 16px;
    color: #333;
}

.info-content {
    font-size: 14px;
    line-height: 1.8;
}

.info-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.info-label {
    font-weight: 600;
    color: #495057;
}

.info-value {
    color: #333;
}

/* ...rest of existing code... */

/* ...existing code... */

/* แก้ไข styles สำหรับ payment และ contact container */
.info-container {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    gap: 20px;
}

.payment-info-box,
.contact-info-box {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
}

.info-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.info-list {
    display: grid;
    gap: 10px;
}

.info-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: baseline;
    gap: 10px;
}

.info-label {
    font-weight: 600;
    color: #495057;
}

.info-value {
    color: #333;
}

/* ...rest of existing code... */

/* ...existing code... */

/* แก้ไข styles สำหรับ info sections */
.info-section-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.info-section {
    flex: 1;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.info-section h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    font-size: 16px;
    color: #333;
}

.info-section table {
    width: 100%;
    border-collapse: collapse;
}

.info-section td {
    padding: 5px 0;
}

.info-section td:first-child {
    width: 100px;
    font-weight: bold;
    color: #495057;
}

/* ...rest of existing code... */

/* ...existing code... */

.info-container {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    gap: 20px;
    margin-bottom: 30px;  /* เพิ่มระยะห่างด้านล่าง */
}

.payment-info-box,
.contact-info-box {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
}

.info-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

.info-list {
    display: grid;
    gap: 10px;
}

.info-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: baseline;
    gap: 10px;
}

.info-label {
    font-weight: 600;
    color: #495057;
}

.info-value {
    color: #333;
}

/* ปรับระยะห่างระหว่างสรุปยอดกับข้อมูลติดต่อ */
.summary-section {
    margin-bottom: 20px;
}

/* ...rest of existing code... */

/* ...existing code... */

.document-info {
    margin: 20px 0;
}

.document-info h2 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 24px;
    color: #333;
}

.document-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: #ffffff;
}

.document-info-table td {
    padding: 8px 15px;
    border: 1px solid #dee2e6;
}

.document-info-table .info-label {
    width: 120px;
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.document-info-table .info-value {
    color: #333;
}

/* ...rest of existing code... */

/* ...existing code... */

.notes {
    margin: 0;  /* ลดระยะห่างด้านบนเพราะมี margin-bottom จาก info-container แล้ว */
    border-radius: 4px;
}

.notes .info-table {
    margin-bottom: 15px;
    width: 100%;
}

.notice-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.notice-list li {
    position: relative;
    padding: 8px 0 8px 20px;
    border-bottom: 1px dashed #dee2e6;
    color: #666;
}

.notice-list li:last-child {
    border-bottom: none;
}

.notice-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #666;
}

.contact-info {
    padding: 15px;
    line-height: 1.6;
    color: #666;
}

.payment-info {
    margin: 20px 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
}

/* ...rest of existing code... */
