*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Noto Sans Thai", sans-serif, Roboto;
  margin: 0 0 100px;
  padding: 0 5px;
  line-height: 1.5;
  color: rgba(0,0,0,0.87);
  background-color: #fff;
}

h1 { font-size: 2.5rem; font-weight: 400; }
h2 { font-size: 2rem; font-weight: 400; }
h3 { font-size: 1.75rem; font-weight: 400; }
h4 { font-size: 1.5rem; font-weight: 400; }
h5 { font-size: 1.1rem; font-weight: 400; }
h6 { font-size: 0.85rem; font-weight: 400; }

.container { width: 95%; max-width: 1200px; margin: 0 auto; padding: 0 5px; }

/* ============================================================
   PIN lock screen
   ============================================================ */
.pin-lock-screen {
  position: fixed;
  inset: 0;
  background: #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
}
.pin-box {
  background: white;
  padding: 30px 25px;
  border-radius: 12px;
  text-align: center;
  width: 90%;
  max-width: 300px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.pin-box input {
  border: 1px solid #ccc;
  border-radius: 6px;
}

.header { justify-self: center; margin: 0; }
.header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: 15px 0;
}
#logoContainer { justify-self: start; display: flex; align-items: center; }
#logoContainer img { max-width: 60px; width: auto; }

.slide-switch-container { justify-self: end; display: flex; align-items: center; gap: 6px; }
.slide-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.slide-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #ccc; transition: 0.4s; border-radius: 34px;
}
.slider:before {
  position: absolute; content: ""; height: 22px; width: 22px;
  left: 3px; bottom: 3px; background-color: white; transition: 0.4s; border-radius: 50%;
}
input:checked + .slider { background-color: #4caf50; }
input:checked + .slider:before { transform: translateX(22px); }
#switchLabel { font-size: 13.5px; }
.off-label { color: red; }

.queue-table { overflow-x: auto; margin-bottom: 2rem; }

.filled-in[type="checkbox"] { position: absolute; opacity: 0; cursor: pointer; }
.filled-in[type="checkbox"] + span {
  position: relative; padding-left: 20px; cursor: pointer; display: inline-block; height: 25px; line-height: 25px;
}
.filled-in[type="checkbox"] + span:before {
  content: ''; position: absolute; top: 0; left: 0; width: 14px; height: 14px; z-index: 0;
  border: 1.5px solid #5a5a5a; border-radius: 3px; margin-top: 8px; transition: .2s;
}
.filled-in[type="checkbox"]:checked + span:before {
  width: 8px; height: 14px; border-top: 2px solid transparent; border-left: 2px solid transparent;
  border-right: 2px solid #26a69a; border-bottom: 2px solid #26a69a; transform: rotate(40deg); backface-visibility: hidden;
}

table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }

.btn {
  font-family: "Noto Sans Thai", sans-serif, Roboto;
  display: inline-block; text-decoration: none; color: #fff; background-color: #26a69a;
  text-align: center; letter-spacing: .5px; transition: background-color .2s ease-out;
  padding: 0 8px; border-radius: 20px; border: none; cursor: pointer;
  line-height: 20px; outline: 0; vertical-align: middle; transition: background-color 0.2s ease;
}
.btn:hover { background-color: #2bbbad; transform: translateY(-2px); box-shadow: 0 5px 10px rgba(0,0,0,0.1); }
.btn.disabled { background-color: #e0e0e0; color: #888; cursor: not-allowed; }
.btn.red { background-color: #f44336; }
.btn.red:hover { background-color: #f56358; }

.table-card { width: 70px; min-height: auto; border-radius: 5px; }
.table-card.has-orders { background-color: #ec7063 !important; color: white; }

.card {
  text-align: center; position: relative; margin: 1rem 0 0 0;
  background-color: #fff; border-radius: 5px; box-shadow: 0.5px 0.5px 3px 0.2px rgba(0,0,0,0.14);
}
.card-content { padding: 2px; border-radius: 0 0 2px 2px; }
.card-title { font-size: 14px; font-weight: 400; }
.card-action { font-size: 10px; position: relative; padding-bottom: 5px; border-radius: 0 0 2px 2px; }

.modal {
  max-width: 100% !important; padding: 0 !important; display: none; position: fixed;
  z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto;
  background-color: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
}
.modal-content {
  position: relative; padding: 20px !important; background-color: #fefefe;
  margin: 20% auto 1%; padding: 10px; border: 1px solid #888; width: 90%;
  max-width: 400px; border-radius: 10px; animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close-icon { font-family: "Noto Sans Thai", sans-serif; font-size: 12px; cursor: pointer; color: white; background-color: grey; }
.modal-close-icon:hover { background-color: #939596; }

.modal-footer {
  width: 80%; max-width: 300px; margin: 0 auto; display: flex;
  padding: 2px 0px 40px; justify-content: space-evenly; gap: 20px;
}
.modal-content input { margin: 8px 0; padding: 6px; }
.modal-content .close { position: absolute; top: 10px; right: 12px; cursor: pointer; }

#receiptContent { font-size: 14px; line-height: 1.4; padding: 10px; }
#receiptContent h6:first-child { font-size: 18px; margin-bottom: 10px; }
.receipt-datetime, .receipt-invoice { font-size: 13px; margin-bottom: 15px; color: #333; }
.receipt-table { font-size: 14px; margin-bottom: 15px; padding: 8px; background-color: #f5f5f5; border-radius: 5px; text-align: left; }
.receipt-item { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed #ddd; }
.receipt-item-name { font-size: 15px; margin-bottom: 4px; }
.receipt-item-total { font-size: 15px; margin-bottom: 4px; text-align: right; padding: 0px 5px; }
.receipt-total { text-align: right; font-size: 15px; margin-top: 15px; margin-bottom: 15px; padding: 10px 5px; background-color: #f0f0f0; border-radius: 5px; }
#receiptContent h6:last-child { font-size: 14px; margin-top: 15px; font-style: italic; }

table.striped tbody tr:nth-child(odd) { background-color: rgba(242, 242, 242, 0.5); }
table thead { border-bottom: 1px solid rgba(0,0,0,0.12); }
th { font-size: 0.9em; }
table th, table td { padding: 8px 5px; text-align: left; }
td small { color: #2d57ed; font-size: 0.9em; }

.row { display: flex; flex-wrap: wrap; margin-left: -15px; margin-right: -15px; }
.row > [class*='col'] { padding: 0 6px; flex-grow: 1; }

.top-row {
  position: fixed; top: 0; display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 15px 10px 10px 0px; background-color: white; border-bottom: 1px solid #ddd; z-index: 9999;
}
.back-btn { font-family: "Noto Sans Thai", sans-serif; background-color: transparent; color: #2196F3; border-radius: 20px; }
.back-btn:hover { background-color: transparent; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); border: 1px solid #2196F3; }

.add-btn {
  font-family: "Noto Sans Thai", sans-serif; background-color: #d44e1e; color: white; border: none;
  padding: 1px 10px; border-radius: 25px; cursor: pointer; font-size: 18px; font-weight: bold; margin: 0 15px;
}
.add-btn:hover { background-color: #c23b0a; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); }

button {
  font-family: "Noto Sans Thai", sans-serif; padding: 4px 8px; border: none; border-radius: 10px;
  cursor: pointer; font-weight: bold; color: #541808; background-color: #f7d059;
}
button:hover { background-color: #edbf32; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.1); }
.wmButton { background-color: #d9d8d7; }

.menu-management { padding: 0px 0px 10px; font-family: "Noto Sans Thai", sans-serif; color: #222; }
.menu-management h2 { margin-bottom: 10px; font-weight: normal; font-size: 14px; }
.name-search { padding: 5px; font-size: 14px; }

.menu-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; padding-top: 20px; }
.menu-item-card { border: 1px solid #ccc; border-radius: 6px; background: #fff; box-shadow: none; height: auto; display: flex; flex-direction: column; overflow: hidden; }
.menu-item-image { height: 100px; overflow: hidden; }
.menu-item-image img { width: 100%; height: 100%; object-fit: cover; }
.menu-item-details { padding: 6px 8px; flex-grow: 1; display: flex; flex-direction: column; font-size: 14px; line-height: 1.2; color: #444; }
.menu-item-details p { margin: 2px 0; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item-description { color: #666; font-size: 12px; white-space: normal; flex-grow: 1; overflow: hidden; text-overflow: ellipsis; }
.menu-item-price { font-size: 12px; color: #222; margin-top: 4px; }
.image-preview img { max-width: 100%; max-height: 150px; margin-top: 6px; border-radius: 6px; }

.edit-btn { font-family: "Noto Sans Thai", sans-serif; background-color: #7ad4fa; color: white; border: none; padding: 2px 12px; border-radius: 4px; cursor: pointer; font-size: 10px; }
.edit-btn:hover { background-color: #4cc7fc; }

.edit-form { background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 8px; padding: 20px; margin-bottom: 20px; max-width: 600px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; transition: border-color 0.2s ease;
}
.form-group textarea { height: 80px; resize: vertical; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.save-btn { background-color: #2ecc71; color: white; border: none; padding: 0px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; }
.save-btn:hover { background-color: #27ae60; }
.cancel-btn { background-color: #95a5a6; color: white; border: none; padding: 0px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; }
.cancel-btn:hover { background-color: #7f8c8d; }
.delete-btn { background-color: #e74c3c; color: white; border: none; padding: 0px 16px; border-radius: 20px; cursor: pointer; font-size: 14px; }
.delete-btn:hover { background-color: #c0392b; }

.loading { display: flex; justify-content: center; align-items: center; padding: 20px; font-style: italic; color: #666; }

.toast {
  visibility: hidden; min-width: 200px; margin-left: -100px; background-color: rgba(40, 250, 250, 0.7);
  color: black; text-align: center; border-radius: 8px; padding: 12px; position: fixed; z-index: 9999;
  left: 50%; bottom: 50%; font-size: 14px; transition: opacity 0.3s ease, visibility 0.3s;
}
.toast.show { visibility: visible; opacity: 1; }

#celebration {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
  background: radial-gradient(circle, #ffdd57 20%, #ff7b00 90%); color: white; padding: 20px 40px;
  border-radius: 50px; font-size: 1.5rem; font-weight: bold; opacity: 0; pointer-events: none; z-index: 9999;
  box-shadow: 0 0 20px rgba(255, 140, 0, 0.6);
}
@keyframes popAnimation {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  40% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  70% { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}
.pop { animation: popAnimation 1.5s ease-out forwards; }

.confirm-modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); }
.confirm-content { background: white; padding: 20px; max-width: 300px; margin: 15% auto; text-align: center; border-radius: 8px; animation: fadeIn 0.3s ease; }
.confirm-buttons button { margin: 10px; padding: 8px 16px; cursor: pointer; }
#confirmYes:hover, #confirmNo:hover { background-color: #2bbbad; transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.3); }

.circle-button-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-top: 20px; }
.circle-btn {
  min-width: 60px; height: 60px; padding: 4px 10px; border-radius: 30px; border: none; font-size: 13px;
  font-family: "Noto Sans Thai", sans-serif; background-color: #f7b14f; cursor: pointer;
  box-shadow: 0px 2px 5px rgba(0,0,0,0.2); transition: background-color 0.3s ease; text-align: center; color: #7a4516;
}
.circle-btn:hover { background-color: #eb9752; }
.circle-btn { transition: transform 0.2s ease; }
.circle-btn.active { transform: translateY(-6px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); border: 3px solid #f7b14f; background-color: #a3652f; color: white; }

.addNewRow { margin-left: 25%; margin-top: 10px; }
.responsive-table-wrapper { overflow-x: auto; margin-top: 10px; }
.responsive-table { width: 100%; max-width: 900px; margin: 0 auto; border-collapse: collapse; }
.responsive-table th { padding: 15px; text-align: right; font-family: "Noto Sans Thai", sans-serif; }
.responsive-table td { padding: 15px; text-align: right; }
.responsive-table input[type="text"], .responsive-table input[type="number"] {
  width: 100%; min-width: 120px; box-sizing: border-box; padding: 6px 8px; border: 1px solid #ccc; border-radius: 4px;
}
.responsive-table .col-0 { width: 40%; }
.responsive-table .col-1 { width: 30%; }
.responsive-table .col-2 { width: 30%; }

@media screen and (max-width: 768px) {
  .responsive-table { width: 90%; font-size: 14px; }
  .responsive-table td { padding: 10px; }
  .responsive-table input[type="text"] { min-width: 100px; }
  .addNewRow { margin-left: 1%; margin-top: 10px; }
}
@media screen and (max-width: 480px) {
  .responsive-table { width: 100%; font-size: 13px; }
  .responsive-table input[type="text"] { min-width: 80px; }
}
.responsive-table td input[type="checkbox"] { display: block; margin: 0 auto; transform: scale(1.2); cursor: pointer; }
.responsive-table td { vertical-align: middle; }

#saleReport { width: 100%; max-width: 600px; justify-self: center; margin-top: 80px; }
#chart_div { display: none; }
.responsive-chart { width: 100%; max-width: 100%; height: 420px; margin-top: 20px; }
@media (max-width: 1024px) { .responsive-chart { height: 360px; } }
@media (max-width: 600px) { .responsive-chart { height: 280px; } }

.stock-toggle { display: flex; align-items: center; justify-items: center; gap: 6px; margin-top: 6px; font-size: 12px; }
.stock-toggle .switch { transform: scale(0.8); transform-origin: left center; }
.switch { position: relative; display: inline-block; width: 50px; height: 25px; margin-top: 0px; }
.switch input { opacity: 0; width: 0; height: 0; }
.stock-status { white-space: nowrap; }
.menu-item-card.out-of-stock { opacity: 0.5; filter: grayscale(60%); transition: opacity 0.3s, filter 0.3s; background-color: #f9f9f9; border: 1px dashed #ccc; }
.menu-item-card.out-of-stock:hover { opacity: 0.7; filter: grayscale(40%); }

#historyReceiptContent { font-size: 14px; line-height: 1.4; padding: 10px; }

.info-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.info-table th, .info-table td { border: 1px solid #ddd; padding: 8px; text-align: left; }
.info-table th { background-color: #f4f4f4; font-weight: bold; font-size: 13px; }
.info-table td { font-size: 12px; }
.editable-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  font-size: 13px;
  font-family: "Noto Sans Thai", sans-serif;
  border-radius: 4px;
}
.editable-input:disabled { color: #333; }
.editable-input:not(:disabled) { border-color: #ccc; background: #fff; }
.editable-textarea { resize: vertical; min-height: 70px; }

.loading-bars { height: 200px; display: flex; justify-content: center; align-items: center; color: #888; font-size: 14px; }
.spinner { width: 24px; height: 24px; border: 3px solid #e0e0e0; border-top: 3px solid #4CAF50; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

input::placeholder { font-family: "Noto Sans Thai"; }