* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f2f2f2;
  color: #222;
}

.topbar {
  height: 52px;
  background: #222;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 18px;
  font-weight: bold;
}

.store-name {
  font-size: 14px;
  font-weight: normal;
  opacity: 0.8;
}

.layout {
  height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 8px;
  padding: 8px;
}

.panel {
  background: white;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.panel-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 12px;
}

.demo-box {
  border: 1px dashed #aaa;
  border-radius: 8px;
  padding: 16px;
  color: #666;
  line-height: 1.5;
}

.bottom-tabs {
  display: none;
}

.tab-button {
  flex: 1;
  border: none;
  background: #333;
  color: white;
  font-size: 15px;
  font-weight: bold;
}

.tab-button.active {
  background: #007bff;
}

/* Phone / small screen (legacy .layout only; POS uses mobile-tab-* on body) */
@media (max-width: 899px) {
  :root {
    --topbar-height: 52px;
    --mobile-tab-bar-height: 52px;
    --mobile-layout-bottom: calc(
      var(--mobile-tab-bar-height) + env(safe-area-inset-bottom, 0px)
    );
  }

  .layout {
    display: block;
    height: calc(100vh - var(--topbar-height) - var(--mobile-layout-bottom));
    height: calc(100dvh - var(--topbar-height) - var(--mobile-layout-bottom));
    padding: 8px;
    box-sizing: border-box;
  }

  .bottom-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--mobile-tab-bar-height);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: content-box;
    z-index: 4000;
  }

  .bottom-tabs .tab-button {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    height: var(--topbar-height);
  }
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 10px;
}

.table-btn {
  min-height: 64px;
  border: 2px solid #ccc;
  border-radius: 12px;
  background: #f9f9f9;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
}

.table-btn.busy {
  background: #ffe1e1;
  border-color: #cc6666;
}

.table-btn.locked {
  background: #eeeeee;
  color: #999999;
}

.table-btn.selected {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.small-status {
  margin-top: 12px;
  color: #444;
  font-size: 15px;
  line-height: 1.4;
}

.section-title {
  font-size: 15px;
  font-weight: bold;
  margin: 6px 0 10px 0;
  color: #333;
}

.menu-items-title {
  margin-top: 18px;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 10px;
}

.category-btn {
  min-height: 58px;
  border: 2px solid #ccc;
  border-radius: 12px;
  background: #f9f9f9;
  cursor: pointer;
  padding: 8px;
  touch-action: manipulation;
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.category-name {
  width: 100%;
  line-height: 1.15;
  font-weight: bold;
  word-break: normal;
  overflow-wrap: break-word;
  text-align: center;
}

.category-btn.selected {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.45);
  transform: scale(0.98);
}

.category-btn:active {
  transform: scale(0.98);
}
.menu-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}



.menu-item-btn:active {
  transform: scale(0.98);
}


.menu-item-price {
  margin-top: 6px;
  font-size: 14px;
  opacity: 0.85;
}

.menu-item-btn.selected {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.45);
}
.menu-item-btn {
  min-height: 72px;
  border: 2px solid #bbb;
  border-radius: 10px;
  background: #f9f9f9;
  cursor: pointer;
  padding: 8px;
  touch-action: manipulation;
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.menu-item-name {
  width: 100%;
  line-height: 1.15;
  font-weight: bold;
  word-break: normal;
  overflow-wrap: break-word;
  text-align: center;
}

.cart-table-line {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 12px;
}

.cart-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-empty {
  color: #666;
  border: 1px dashed #bbb;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.4;
}

.cart-line {
  display: grid;
  grid-template-columns: 32px 1fr 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}

.cart-line-no {
  font-weight: bold;
  color: #666;
}

.cart-line-name {
  font-size: 15px;
  font-weight: bold;
}

.cart-remove-button {
  height: 32px;
  border: none;
  border-radius: 6px;
  background: #dc3545;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.cart-summary {
  margin-top: 12px;
  font-size: 16px;
  font-weight: bold;
  text-align: right;
}

.cart-action-button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

.clear-cart-button {
  background: #dddddd;
  color: #222;
}

.send-order-button {
  background: #007bff;
  color: white;
}

.send-order-button:disabled {
  background: #999;
  cursor: not-allowed;
}


.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  width: min(520px, 100%);
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.modal-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 14px;
  text-align: center;
}

.price-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.price-option-button {
  min-height: 58px;
  border: 2px solid #bbb;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.price-option-button:active {
  transform: scale(0.98);
}

.modal-cancel-button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: none;
  border-radius: 10px;
  background: #dddddd;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}

.submenu-modal-box {
  width: min(760px, 100%);
}

.submenu-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.submenu-option-button {
  min-height: 66px;
  border: 2px solid #bbb;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  padding: 8px;
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.submenu-option-button.selected {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.45);
}

.cart-sub-line {
  margin-top: 4px;
  padding-left: 10px;
  font-size: 13px;
  font-weight: normal;
  color: #555;
}

.cart-line {
  cursor: pointer;
}

.cart-line.selected {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.35);
  background: #eef6ff;
}

/* =========================================================
   POS-compatible tablet landscape layout
   ========================================================= */

.pos-layout {
  height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: 38% 1fr 220px;
  gap: 8px;
  padding: 8px;
  background: #f2f2f2;
}

.pos-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.order-panel,
.menu-panel,
.category-panel,
.control-panel {
  min-width: 0;
  min-height: 0;
}


.order-panel {
  overflow: auto;
}

.order-header-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.order-header-label {
  font-size: 12px;
  font-weight: bold;
  text-align: center;
}

.order-header-value {
  min-height: 28px;
  border: 1px solid #bbb;
  background: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.order-list-title {
  font-size: 16px;
  font-weight: bold;
  margin: 8px 0;
}

.mobile-order-compact-bar,
.mobile-compact-order-summary,
.landscape-order-compact-bar,
.landscape-compact-order-summary,
.landscape-order-expanded-collapse-btn {
  display: none;
}

.control-panel {
  overflow: auto;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.control-grid #saveOrderButton {
  grid-column: 1 / -1;
  width: 100%;
}

.pos-control-btn {
  min-height: 52px;
  border: 1px solid #999;
  border-radius: 6px;
  background: #d9d9d9;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
}

.pos-control-btn.primary {
  background: #3f7fca;
  color: white;
}

.pos-control-btn.danger {
  background: #b5232e;
  color: white;
}

.menu-panel {
  overflow: auto;
}

.category-panel {
  overflow: auto;
}

.category-panel .categories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.category-panel .category-btn {
  min-height: 62px;
}

.menu-panel .menu-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 10px;
}

#tableSelectHidden {
  display: none;
}

/* Order list keeps using the current cart-line style */
.cart-lines {
  gap: 6px;
}

.cart-line {
  cursor: pointer;
}

.cart-line.selected {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.35);
  background: #eef6ff;
}

/* Tablet landscape: hide old mobile tabs */
@media (min-width: 900px) {
  .bottom-tabs {
    display: none !important;
  }
}

/* Tablet / iPad landscape: wider order panel, narrower categories, smaller menu buttons */
@media (min-width: 900px) and (orientation: landscape) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .pos-layout {
    grid-template-columns: minmax(420px, 42%) minmax(0, 46%) minmax(120px, 12%);
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "left menu category"
      "left controls category";
    gap: 8px;
    height: calc(100dvh - 52px);
    min-height: 0;
    overflow: hidden;
  }

  .pos-layout > .pos-left,
  .pos-layout > .menu-panel,
  .pos-layout > .control-panel,
  .pos-layout > .category-panel {
    min-height: 0;
  }

  .pos-left {
    grid-area: left;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .pos-left > .order-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .pos-left > .order-panel .order-header-grid,
  .pos-left > .order-panel .order-list-title,
  .pos-left > .order-panel #cartSummary,
  .pos-left > .order-panel .order-summary-panel,
  .pos-left > .order-panel .landscape-order-compact-bar,
  .pos-left > .order-panel .landscape-compact-order-summary,
  .pos-left > .order-panel .landscape-order-expanded-collapse-btn {
    flex: 0 0 auto;
  }

  .order-panel .mobile-order-compact-bar,
  .order-panel .mobile-compact-order-summary {
    display: none !important;
  }

  body:not(.landscape-order-details-expanded) .order-panel .order-header-grid,
  body:not(.landscape-order-details-expanded) .order-panel .order-summary-panel {
    display: none;
  }

  body:not(.landscape-order-details-expanded) .order-panel #cartSummary {
    display: none;
  }

  body:not(.landscape-order-details-expanded) .order-panel .landscape-order-compact-bar,
  body:not(.landscape-order-details-expanded) .order-panel .landscape-compact-order-summary {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 6px;
    font-weight: bold;
    line-height: 1.2;
  }

  body:not(.landscape-order-details-expanded) .order-panel .landscape-order-compact-bar {
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 32px;
    max-height: 36px;
    margin: 0 0 6px;
    padding: 0 10px;
    background: #eef6ff;
    border: 1px solid #b8d4f0;
    border-family: inherit;
    font-size: 12px;
    color: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
  }

  body:not(.landscape-order-details-expanded) .order-panel #landscapeCompactOrderText {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.landscape-order-details-expanded) .order-panel .landscape-order-compact-date {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: normal;
    opacity: 0.85;
    white-space: nowrap;
    margin-left: 6px;
  }

  body:not(.landscape-order-details-expanded) .order-panel .landscape-order-compact-toggle-icon {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    opacity: 0.85;
    margin-left: 4px;
  }

  body:not(.landscape-order-details-expanded) .order-panel .landscape-compact-order-summary {
    min-height: 30px;
    max-height: 34px;
    margin-top: 4px;
    padding: 0 10px;
    background: #f4f4f4;
    border: 1px solid #ccc;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.landscape-order-details-expanded .order-panel .landscape-order-compact-bar,
  body.landscape-order-details-expanded .order-panel .landscape-compact-order-summary {
    display: none !important;
  }

  body.landscape-order-details-expanded .order-panel .order-header-grid {
    display: grid;
  }

  body.landscape-order-details-expanded .order-panel .order-summary-panel {
    display: block;
  }

  body.landscape-order-details-expanded .order-panel #cartSummary {
    display: block;
  }

  body.landscape-order-details-expanded .order-panel .landscape-order-expanded-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    width: 34px;
    min-height: 28px;
    margin: 0 0 4px;
    padding: 0;
    border: 1px solid #b8d4f0;
    border-radius: 6px;
    background: #eef6ff;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
  }

  .order-panel .order-header-grid {
    grid-template-columns:
      minmax(72px, 0.85fr)
      minmax(0, 1.5fr)
      minmax(64px, 0.95fr)
      minmax(48px, 0.65fr)
      minmax(64px, 0.85fr)
      minmax(34px, 0.4fr);
    gap: 5px;
  }

  .order-panel .order-header-label {
    font-size: 11px;
    line-height: 1.15;
  }

  .order-panel .order-header-value {
    min-height: 26px;
    font-size: 12px;
    padding: 0 4px;
  }

  .pos-left > .order-panel .cart-lines {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .pos-left > .order-panel .cart-lines .order-grid-header {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .menu-panel {
    grid-area: menu;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .menu-panel .panel-title,
  .menu-panel .small-status {
    flex: 0 0 auto;
  }

  .menu-panel .menu-items-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
    gap: 8px;
    align-content: start;
    grid-auto-rows: 62px;
  }

  .pos-layout > .control-panel {
    grid-area: controls;
    flex: 0 0 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .category-panel {
    grid-area: category;
    grid-row: 1 / -1;
  }

  .menu-item-btn {
    min-height: 62px;
    height: 62px;
    max-height: 62px;
    align-self: start;
    padding: 6px 8px;
  }

  .category-panel {
    padding: 8px;
  }

  .category-panel .panel-title {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .category-panel .categories-grid {
    gap: 5px;
  }

  .category-panel .category-btn {
    min-height: 58px;
    padding: 8px 6px;
    border-radius: 10px;
  }

  .category-name {
    font-size: 13px;
    line-height: 1.2;
  }

  .menu-item-name {
    font-size: 14px;
    line-height: 1.2;
  }

  .order-panel .order-grid-header,
  .order-panel .order-grid-row,
  .order-panel .order-grid-sub-row {
    grid-template-columns: 34px minmax(0, 1fr) 54px 64px 72px 54px 38px;
    gap: 5px;
  }

  .order-panel .order-desc {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.25;
    text-overflow: ellipsis;
  }

  .order-panel .order-sub-desc {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.2;
  }

  .control-grid {
    gap: 5px;
  }

  .pos-control-btn {
    min-height: 48px;
    font-size: 13px;
  }

  .pos-control-btn.ipad {
    min-height: 48px;
    font-size: 12px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .control-panel .send-order-button {
    min-height: 50px;
    font-size: 15px;
  }

  .mobile-item-edit-actions,
  .mobile-more-actions,
  .mobile-primary-actions {
    display: contents;
  }

  #mobileMoreActionsBtn {
    display: none !important;
  }

  .control-grid #qtyButton { order: 1; }
  .control-grid #priceButton { order: 2; }
  .control-grid #discountButton { order: 3; }
  .control-grid #splitLineButton { order: 4; }
  .control-grid #instructionButton { order: 5; }
  .control-grid #spellInstructionButton { order: 6; }
  .control-grid #printBillButton { order: 7; }
  .control-grid #tableOrderButton { order: 8; }
  .control-grid #customerNameButton { order: 9; }
  .control-grid #menuGroupButton { order: 10; }
  .control-grid #changeUserButton { order: 11; }
  .control-grid #quitButton { order: 12; }
  .control-grid #saveOrderButton { order: 13; }
  .control-grid #stayAwakeButton { order: 14; }
  .control-grid #fullScreenButton { order: 15; }
  .control-grid #downloadMenuButton { order: 16; }
}

/* Phone: one main pane at a time via body.mobile-tab-* (tablet >=900px unchanged) */
@media (max-width: 899px) {
  .pos-layout {
    display: block;
    height: calc(100vh - var(--topbar-height) - var(--mobile-layout-bottom));
    height: calc(100dvh - var(--topbar-height) - var(--mobile-layout-bottom));
    padding: 8px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .pos-layout > .pos-left,
  .pos-layout > .menu-panel,
  .pos-layout > .category-panel {
    display: none;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-tab-order .pos-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 6px;
    min-height: 0;
    overflow: hidden;
    height: calc(100vh - var(--topbar-height) - var(--mobile-layout-bottom));
    height: calc(100dvh - var(--topbar-height) - var(--mobile-layout-bottom));
    box-sizing: border-box;
  }

  body.mobile-tab-order .pos-layout > .pos-left {
    display: flex;
    flex-direction: column;
    grid-row: 1;
    min-height: 0;
    overflow: hidden;
  }

  body.mobile-tab-order .pos-left > .order-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
  }

  body.mobile-tab-order .pos-layout > .control-panel {
    display: block;
    grid-row: 2;
    height: auto;
    min-height: 0;
    max-height: none;
    align-self: end;
    overflow-y: visible;
    overflow-x: hidden;
    padding: 8px;
    padding-bottom: 8px;
  }

  body.mobile-tab-order.mobile-item-edit-active .pos-layout > .control-panel,
  body.mobile-tab-order.mobile-more-actions-open .pos-layout > .control-panel {
    max-height: min(52vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: 8px;
  }

  body.mobile-tab-order .pos-layout > .menu-panel,
  body.mobile-tab-order .pos-layout > .category-panel {
    display: none;
  }

  body.mobile-tab-menu .pos-layout > .control-panel {
    display: none;
  }

  body.mobile-tab-order .order-header-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 4px 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
  }

  body.mobile-tab-order .order-header-grid > div {
    min-width: 0;
  }

  body.mobile-tab-order .order-header-label {
    font-size: 10px;
    line-height: 1.2;
    padding: 0 2px;
  }

  body.mobile-tab-order .order-header-value {
    min-height: 22px;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.mobile-tab-order .order-list-title {
    font-size: 13px;
    margin: 4px 0 6px;
    flex-shrink: 0;
  }

  body.mobile-tab-order.mobile-order-collapsed .topbar {
    display: none;
  }

  body.mobile-tab-order.mobile-order-collapsed .order-header-grid {
    display: none;
  }

  body.mobile-tab-order.mobile-order-collapsed .pos-layout {
    height: calc(100vh - var(--mobile-layout-bottom));
    height: calc(100dvh - var(--mobile-layout-bottom));
  }

  body.mobile-tab-order.mobile-order-collapsed .mobile-order-compact-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    flex: 0 0 auto;
    min-height: 36px;
    max-height: 36px;
    margin: 0 0 6px;
    padding: 0 10px;
    background: #eef6ff;
    border: 1px solid #b8d4f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    line-height: 1.2;
    color: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    overflow: hidden;
  }

  body.mobile-tab-order.mobile-order-collapsed #mobileCompactOrderText {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.mobile-tab-order.mobile-order-collapsed .mobile-order-compact-expand-icon {
    flex: 0 0 auto;
    font-size: 10px;
    line-height: 1;
    opacity: 0.85;
  }

  body.mobile-tab-order .pos-left > .order-panel .cart-lines {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
    padding-bottom: 48px;
  }

  body.mobile-tab-order .order-panel #cartSummary,
  body.mobile-tab-order .order-panel .order-summary-panel {
    flex-shrink: 0;
  }

  body.mobile-tab-order .order-panel #cartSummary {
    font-size: 12px;
    margin-top: 4px;
  }

  body.mobile-tab-order.mobile-order-collapsed .order-panel #cartSummary,
  body.mobile-tab-order.mobile-order-collapsed .order-panel .order-summary-panel {
    display: none;
  }

  body.mobile-tab-order.mobile-order-collapsed .mobile-compact-order-summary {
    display: flex !important;
    align-items: center;
    flex: 0 0 auto;
    min-height: 32px;
    max-height: 36px;
    margin-top: 4px;
    padding: 0 10px;
    background: #f4f4f4;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.mobile-tab-order .order-summary-panel {
    margin-top: 6px;
    padding-top: 6px;
  }

  body.mobile-tab-order .order-summary-panel .summary-row {
    font-size: 12px;
    padding: 2px 0;
  }

  body.mobile-tab-order .order-summary-panel .summary-total {
    font-size: 14px;
  }

  body.mobile-tab-order .order-grid-header,
  body.mobile-tab-order .order-grid-row,
  body.mobile-tab-order .order-grid-sub-row {
    /* Phone: No | Description | Qty | Price | Amount | X (Dis% hidden) */
    grid-template-columns: 24px minmax(0, 1fr) 42px 54px 62px 38px;
    gap: 3px 5px;
    align-items: center;
  }

  body.mobile-tab-order .order-discount {
    display: none !important;
  }

  body.mobile-tab-order .order-grid-header {
    font-size: 10px;
    font-weight: bold;
    padding: 4px 4px;
    margin-bottom: 2px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f0f0f0;
  }

  body.mobile-tab-order .order-grid-row {
    font-size: 11px;
    padding: 5px 4px;
    margin-bottom: 4px;
  }

  body.mobile-tab-order .order-grid-sub-row {
    font-size: 10px;
    padding: 3px 4px;
    margin: 0 0 4px 0;
  }

  body.mobile-tab-order .order-desc {
    font-size: 11px;
    font-weight: bold;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
  }

  body.mobile-tab-order .order-sub-desc {
    font-size: 10px;
    padding-left: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
  }

  body.mobile-tab-order .order-number,
  body.mobile-tab-order .order-qty,
  body.mobile-tab-order .order-price,
  body.mobile-tab-order .order-amount {
    font-size: 10px;
    text-align: right;
    white-space: nowrap;
  }

  body.mobile-tab-order .order-price,
  body.mobile-tab-order .order-amount {
    font-size: 11px;
    font-weight: bold;
  }

  body.mobile-tab-order .order-remove-button {
    display: block;
    width: 100%;
    min-width: 30px;
    min-height: 34px;
    height: auto;
    padding: 0 2px;
    font-size: 12px;
    line-height: 1;
    justify-self: stretch;
    align-self: center;
    flex-shrink: 0;
    touch-action: manipulation;
  }

  body.mobile-tab-order .order-grid-row > .order-remove-button,
  body.mobile-tab-order .order-grid-sub-row > div:last-child {
    overflow: visible;
  }

  body.mobile-tab-order .control-panel .control-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
  }

  body.mobile-tab-order .mobile-item-edit-actions,
  body.mobile-tab-order .mobile-more-actions {
    display: none;
  }

  body.mobile-tab-order.mobile-item-edit-active .mobile-item-edit-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  body.mobile-tab-order.mobile-item-edit-active #instructionButton {
    grid-column: 1 / span 2;
  }

  body.mobile-tab-order.mobile-item-edit-active #spellInstructionButton {
    grid-column: 3 / span 2;
  }

  body.mobile-tab-order.mobile-more-actions-open .mobile-more-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    max-height: min(34vh, 240px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.mobile-tab-order .mobile-more-actions #stayAwakeButton,
  body.mobile-tab-order .mobile-more-actions #fullScreenButton {
    display: none !important;
  }

  body.mobile-tab-order .mobile-primary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  body.mobile-tab-order .mobile-primary-actions #saveOrderButton {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
  }

  body.mobile-tab-order .mobile-more-toggle-btn {
    background: #e8e8e8;
  }

  body.mobile-tab-order.mobile-more-actions-open .mobile-more-toggle-btn {
    background: #3f7fca;
    color: #fff;
    border-color: #2f6eb0;
  }

  body.mobile-tab-order .pos-control-btn {
    min-height: 44px;
    font-size: 12px;
  }

  body.mobile-tab-order .mobile-primary-actions #saveOrderButton {
    min-height: 48px;
    font-size: 15px;
    font-weight: bold;
    position: relative;
    z-index: 1;
  }

  body.mobile-tab-order .mobile-primary-actions #tableOrderButton {
    min-height: 44px;
  }

  /* DOM order is menu then category; place category row 1, menu row 2 */
  body.mobile-tab-menu .pos-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 6px;
    min-height: 0;
  }

  body.mobile-tab-menu .pos-layout > .category-panel {
    grid-row: 1;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: min(32vh, 168px);
    min-height: 0;
    overflow: hidden;
    flex-shrink: 0;
    align-self: start;
  }

  body.mobile-tab-menu .pos-layout > .menu-panel {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    align-self: stretch;
  }

  body.mobile-tab-menu .category-panel .panel-title,
  body.mobile-tab-menu .menu-panel .panel-title {
    margin-bottom: 6px;
    font-size: 16px;
    flex-shrink: 0;
  }

  body.mobile-tab-menu .category-panel .categories-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 0 0 auto;
    width: 100%;
    align-content: flex-start;
    padding-bottom: 4px;
  }

  body.mobile-tab-menu .category-panel .category-btn {
    flex: 0 0 auto;
    min-width: 104px;
    min-height: 48px;
  }

  body.mobile-tab-menu .category-panel .small-status {
    flex-shrink: 0;
    margin-top: 4px;
  }

  body.mobile-tab-menu .menu-panel .menu-items-grid {
    display: grid;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-content: start;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 8px;
  }

  body.mobile-tab-menu .menu-panel .small-status {
    flex-shrink: 0;
    margin-top: 4px;
  }

  .table-select-modal-box {
    width: 100%;
    max-height: calc(100vh - 104px);
    max-height: calc(100dvh - 104px);
    display: flex;
    flex-direction: column;
    padding: 12px;
    overflow: hidden;
  }

  .table-select-modal-box .modal-title {
    flex-shrink: 0;
    font-size: 18px;
    margin-bottom: 8px;
  }

  .table-select-modal-box .table-page-tabs {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
    padding: 2px 2px 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .table-select-modal-box .table-page-tab {
    flex: 0 0 auto;
    min-width: max-content;
    min-height: 48px;
    height: auto;
    padding: 10px 16px;
    border: 2px solid #bbb;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.3;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    touch-action: manipulation;
  }

  .table-select-modal-box .table-page-tab.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
  }

  .table-select-modal-box .table-select-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .table-select-modal-box .table-select-content .panel-title {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .table-select-modal-box .table-select-content .tables-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
  }

  .table-select-modal-box .table-select-content .table-btn {
    min-height: 58px;
    font-size: 18px;
  }

  .table-select-modal-box .modal-cancel-button {
    flex-shrink: 0;
    margin-top: 10px;
    min-height: 48px;
  }

  /* Instruction modal: cap height, scroll options + selected lists, pin OK/Cancel */
  #instructionModal.modal-backdrop {
    padding: 10px;
    align-items: center;
  }

  #instructionModal .submenu-modal-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    overflow: hidden;
    padding: 12px;
  }

  #instructionModal .modal-title,
  #instructionModal .instruction-tabs,
  #instructionModal #instructionStatus,
  #instructionModal .instruction-selected-title,
  #instructionModal .instruction-action-row {
    flex-shrink: 0;
  }

  #instructionModal .modal-title {
    font-size: 18px;
    margin-bottom: 8px;
  }

  #instructionModal #instructionOptionsGrid {
    flex: 0 1 auto;
    max-height: min(36vh, 280px);
    min-height: 72px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    margin-top: 8px;
    margin-bottom: 4px;
  }

  #instructionModal .instruction-selected-title {
    margin-top: 6px;
    font-size: 14px;
  }

  #instructionModal .instruction-selected-list {
    flex: 0 1 auto;
    max-height: min(24vh, 200px);
    min-height: 48px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #instructionModal .instruction-action-row {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    background: #fff;
  }

  #instructionModal .instruction-selected-line {
    grid-template-columns: minmax(0, 1fr) 48px 54px 34px;
    gap: 4px;
    padding: 5px 4px;
    font-size: 12px;
  }

  #instructionModal .instruction-selected-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #instructionModal .instruction-selected-remove {
    display: block;
    width: 100%;
    min-width: 30px;
    min-height: 34px;
    height: auto;
    touch-action: manipulation;
  }
}

/* =========================================================
   Scroll behaviour for tablet / iPad
   ========================================================= */

.order-panel,
.menu-panel,
.category-panel,
.control-panel {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Make the Send button fit the control panel */
.control-panel .send-order-button {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

.control-panel .send-order-button:disabled {
  background: #999;
  color: white;
  cursor: not-allowed;
}

.pos-control-btn.ipad {
  background: #2f9e44;
  color: white;
}

.pos-control-btn.ipad.active {
  background: #087f5b;
  color: white;
  box-shadow: 0 0 0 3px rgba(47, 158, 68, 0.35);
}

.pos-control-btn.ipad.download-menu-button {
  background-color: #f97316;
  color: white;
}

.pos-control-btn.ipad.download-menu-button:disabled {
  background-color: #fdba74;
  color: white;
  cursor: not-allowed;
}
.table-select-modal-box {
  width: min(900px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.table-select-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-select-content .panel {
  box-shadow: none;
  padding: 8px;
}

.table-select-content .tables-grid {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.table-page-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-page-tab {
  min-width: 110px;
  min-height: 42px;
  border: 2px solid #bbb;
  border-radius: 8px;
  background: #eeeeee;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

.table-page-tab.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* =========================================================
   Current Order grid display
   ========================================================= */

.order-grid-header,
.order-grid-row,
.order-grid-sub-row {
  display: grid;
  grid-template-columns: 38px 1fr 58px 68px 75px 58px 40px;
  align-items: center;
  gap: 6px;
}

.order-grid-header {
  font-size: 13px;
  font-weight: bold;
  border-bottom: 2px solid #ccc;
  padding: 6px 8px;
  background: #f0f0f0;
}

.order-grid-row {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
  margin-bottom: 6px;
  cursor: pointer;
}

.order-grid-row.selected {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.35);
  background: #eef6ff;
}

.order-grid-sub-row {
  padding: 4px 8px 4px 8px;
  margin: -4px 0 6px 0;
  font-size: 13px;
  color: #444;
}

.order-desc {
  font-weight: bold;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Saved existing lines — light green (Delphi TableOrder style) */
.order-grid-row.order-line-old {
  background: #dff5df;
  border-color: #b8ddb8;
}

.order-grid-row.order-line-new {
  background: #ffffff;
  border-color: #ddd;
}

.order-grid-row.order-line-void {
  background: #fde8e8;
  border-color: #f1c0c0;
}

.order-grid-row.order-line-old.selected {
  background: #cfe8cf;
  border-color: #007bff;
}

.order-grid-row.order-line-new.selected {
  background: #eef6ff;
}

.order-grid-row.order-line-void.selected {
  background: #f8d4d4;
  border-color: #007bff;
}

.order-sub-desc {
  padding-left: 18px;
  font-weight: normal;
  color: #0044cc;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-grid-sub-row.order-line-old {
  background: #dff5df;
  border-radius: 6px;
}

.order-grid-sub-row.order-line-new {
  background: #ffffff;
  border-radius: 6px;
}

.order-grid-sub-row.order-line-void {
  background: #fde8e8;
  border-radius: 6px;
}

.order-grid-sub-row.order-line-old.selected,
.order-grid-sub-row.order-line-new.selected,
.order-grid-sub-row.order-line-void.selected {
  background: #eef6ff;
}

.order-qty-negative {
  color: #b02a37;
  font-weight: bold;
}

.order-number,
.order-qty,
.order-price,
.order-amount {
  text-align: right;
}

.order-remove-button {
  height: 30px;
  border: none;
  border-radius: 6px;
  background: #dc3545;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.order-grid-empty {
  color: #666;
  border: 1px dashed #bbb;
  border-radius: 8px;
  padding: 14px;
  line-height: 1.4;
}


.order-summary-panel {
  margin-top: 10px;
  border-top: 2px solid #ccc;
  padding-top: 8px;
}

.summary-row-hidden {
  display: none;
}

.summary-row {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
  padding: 3px 0;
  font-size: 15px;
  font-weight: bold;
}

.summary-row span:last-child {
  text-align: right;
}

.summary-total {
  font-size: 17px;
}

.number-pad-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  touch-action: manipulation;
}

.number-pad-panel {
  background: #ffffff;
  width: 420px;
  max-width: 92vw;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.number-pad-title {
  font-size: 22px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 12px;
  touch-action: manipulation;
}

.number-pad-display {
  width: 100%;
  height: 56px;
  font-size: 28px;
  font-weight: bold;
  text-align: right;
  padding: 8px 12px;
  margin-bottom: 14px;
  border: 1px solid #999;
  border-radius: 6px;
  box-sizing: border-box;
  background: #fff;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.number-pad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, minmax(72px, 1fr));
  gap: 6px;
  align-items: stretch;
  touch-action: manipulation;
}

/* Explicit placement (unchanged DOM order). OK spans rows 1–2 in column 4. */
.number-pad-grid > :nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.number-pad-grid > :nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.number-pad-grid > :nth-child(3) {
  grid-column: 3;
  grid-row: 1;
}

.number-pad-grid > :nth-child(4) {
  grid-column: 4;
  grid-row: 1 / span 2;
}

.number-pad-grid > :nth-child(5) {
  grid-column: 1;
  grid-row: 2;
}

.number-pad-grid > :nth-child(6) {
  grid-column: 2;
  grid-row: 2;
}

.number-pad-grid > :nth-child(7) {
  grid-column: 3;
  grid-row: 2;
}

.number-pad-grid > :nth-child(8) {
  grid-column: 4;
  grid-row: 3;
}

.number-pad-grid > :nth-child(9) {
  grid-column: 1;
  grid-row: 3;
}

.number-pad-grid > :nth-child(10) {
  grid-column: 2;
  grid-row: 3;
}

.number-pad-grid > :nth-child(11) {
  grid-column: 3;
  grid-row: 3;
}

.number-pad-grid > :nth-child(12) {
  grid-column: 4;
  grid-row: 4;
}

.number-pad-grid > :nth-child(13) {
  grid-column: 1;
  grid-row: 4;
}

.number-pad-grid > :nth-child(14) {
  grid-column: 2;
  grid-row: 4;
}

.number-pad-grid > :nth-child(15) {
  grid-column: 3;
  grid-row: 4;
}

.number-pad-key,
.number-pad-action {
  font-size: 18px;
  font-weight: bold;
  border: 1px solid #888;
  background: #f5f5f5;
  border-radius: 4px;
  cursor: pointer;
  min-height: 0;
  height: 100%;
  padding: 4px 6px;
  box-sizing: border-box;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.number-pad-key:active,
.number-pad-action:active {
  background: #e3e3e3;
}

@media (max-width: 899px) {
  .number-pad-panel {
    width: 95vw;
  }

  .number-pad-grid {
    grid-template-rows: repeat(4, minmax(64px, 1fr));
    gap: 5px;
  }

  .number-pad-title {
    font-size: 18px;
  }

  .number-pad-display {
    font-size: 18px;
  }

  .number-pad-key,
  .number-pad-action {
    font-size: 16px;
  }
}

.order-grid-sub-row {
  cursor: pointer;
}

.order-grid-sub-row.selected {
  border: 1px solid #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
  background: #eef6ff;
  border-radius: 6px;
}

.order-discount {
  text-align: right;
}

.discount-mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.discount-mode-button {
  min-height: 58px;
  border: 2px solid #bbb;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.instruction-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.instruction-tab {
  min-height: 46px;
  border: 2px solid #bbb;
  border-radius: 8px;
  background: #eeeeee;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.instruction-tab.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

.instruction-selected-title {
  margin-top: 14px;
  font-size: 15px;
  font-weight: bold;
}

.instruction-selected-list {
  min-height: 50px;
  border: 1px dashed #bbb;
  border-radius: 8px;
  padding: 8px;
  margin-top: 6px;
  background: #fafafa;
}

.instruction-selected-line {
  display: grid;
  grid-template-columns: 1fr 60px 70px 36px;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.instruction-selected-line:last-child {
  border-bottom: none;
}

.instruction-selected-name {
  font-weight: bold;
}

.instruction-selected-remove {
  height: 30px;
  border: none;
  border-radius: 6px;
  background: #dc3545;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.instruction-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.modal-ok-button {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: #007bff;
  color: white;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
}
.text-input-box {
  width: 100%;
  min-height: 54px;
  font-size: 24px;
  font-weight: bold;
  padding: 8px 12px;
  border: 1px solid #999;
  border-radius: 8px;
  box-sizing: border-box;
}

.menu-group-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.menu-group-button {
  min-height: 58px;
  border: 2px solid #bbb;
  border-radius: 10px;
  background: #f9f9f9;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.menu-group-button.active {
  background: #007bff;
  color: white;
  border-color: #007bff;
}


#currentPeopleText {
  cursor: pointer;
}

#currentPeopleText:hover {
  background: #eef6ff;
}

.confirm-modal-box {
  width: min(460px, 92vw);
}

.confirm-message {
  font-size: 18px;
  line-height: 1.4;
  text-align: center;
  padding: 18px 8px;
  font-weight: bold;
}

.confirm-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* =========================================================
   Device authorization screen
   ========================================================= */

.device-auth-screen {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f2f2;
  padding: 20px;
}

.device-auth-box {
  width: min(420px, 94vw);
  background: white;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 3px 16px rgba(0,0,0,0.25);
}

.device-auth-title {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 12px;
}

.device-auth-store {
  text-align: center;
  font-size: 16px;
  margin-bottom: 18px;
  color: #555;
}

.device-auth-label {
  display: block;
  font-weight: bold;
  margin-top: 12px;
  margin-bottom: 6px;
}

.device-auth-input {
  width: 100%;
  height: 46px;
  font-size: 18px;
  padding: 8px 10px;
  border: 1px solid #999;
  border-radius: 8px;
  box-sizing: border-box;
}

.device-auth-button {
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  border: none;
  border-radius: 8px;
  background: #007bff;
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.device-auth-message {
  margin-top: 14px;
  font-size: 14px;
  color: #b00020;
  text-align: center;
  white-space: pre-wrap;
}

body.device-not-authorized .pos-layout,
body.device-not-authorized .bottom-tabs {
  display: none !important;
}

body.device-authorized .device-auth-screen {
  display: none !important;
}

body.staff-not-logged-in .pos-layout,
body.staff-not-logged-in .bottom-tabs {
  pointer-events: none;
  opacity: 0.55;
}

body.staff-not-logged-in #changeUserButton {
  pointer-events: auto;
  opacity: 1;
}

.pos-control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}