/* Fixes for things that sat on top of each other. Loaded last, so these win over the other style files. */

/* Pop-up messages: the "+1" count badge used to float over the message's own button (View, Receipt). It now sits under the
   message, at the right, and the messages start below the top bar instead of covering the clock and menu. */
#pos-toast-stack { inset-block-start:68px; }
#pos-toast-stack[data-expanded="false"] { padding-block-end:0; }
#pos-toast-stack .pos-toast-toggle { position:static; display:block; inset:auto; width:auto; min-width:44px; min-height:28px; margin:calc(var(--pos-toast-peek,0px) + 8px) 0 0 auto; padding:2px 12px; }
#pos-toast-stack .pos-toast-toggle[hidden] { display:none; }
#pos-toast-stack:has(.pos-toast-toggle:not([hidden])) .pos-toast-card[data-front="true"] { padding-inline-end:18px; }
/* Inside a pop-up box the messages sit at its top edge, not over its buttons. */
dialog #pos-toast-stack { inset-block-start:10px; }
/* Rows of figures (Trial Balance, Journal and others): on a phone they go two to a row and long amounts wrap, instead of running into each other. */
@media (max-width:560px) {
  .metrics { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }
  .metrics > * { min-width:0; }
  .metrics :is(strong,b) { overflow-wrap:anywhere; font-size:clamp(15px,4.6vw,22px); }
}
/* POS action buttons on a phone: two rows of six so every label fits inside its own button. */
@media (max-width:640px) {
  .terminalgrid aside.pos-action-rail { display:grid !important; grid-template-columns:repeat(6,minmax(0,1fr)); gap:4px; }
  .terminalgrid aside.pos-action-rail > *, .terminalgrid aside.pos-action-rail > :first-child { flex:none !important; width:auto !important; min-width:0 !important; font-size:10.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
/* Summary tiles: a long figure or phrase wraps inside its tile instead of spilling out. */
.st-kpi strong { white-space:normal; overflow-wrap:anywhere; }
/* Tables inside pop-up boxes: long text (an address, a name) wraps inside its cell. */
dialog :is(td,th) { white-space:normal; overflow-wrap:anywhere; }
/* The keyboard's own title bar: the word "Keyboard" shortens instead of running under the buttons beside it. */
.pos-keyboard-panel [data-pos-keyboard-drag], .pos-keyboard-panel header > :first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* The small keyboard button inside pop-up boxes is icon-only; its word used to run under the close button beside it. */
.pos-keyboard-dialog-trigger > span { display:none !important; }
/* POS bottom row: the "‹ Tables" / "‹ Orders" back button is lighter than Order, so Order and Cash stand out. */
.cartbottom button.secondary[data-act="posleave"] { background:var(--pale) !important; color:var(--primary) !important; border-color:var(--primary) !important; }
/* POS item cards outside their selling hours or sold out: the "From 12:00" / "Sold out" tag sits on the top-right corner, poking slightly out, so it never covers the name or price. The grid keeps room so the top row and right column tags are not cut off. */
.food.food-off::after { inset:-9px -6px auto auto !important; padding:2px 9px; font-size:11px; line-height:16px; box-shadow:0 2px 6px rgb(0 0 0 / .18); z-index:1; }
.foodgrid { padding-top:12px; padding-right:8px; }
/* POS order header: "+ New order" sits on the same centre line as the table button beside it. */
.pos-ticket .pos-ticket-meta .pos-new-order { align-self:center; }
/* The card's contents fade, but the corner tag stays solid so it can be read. */
.food.food-off { opacity:1 !important; }
.food.food-off > * { opacity:.5; }
/* POS: the table button lives in the top bar. When the top bar shows it, the copy in the order header is hidden; with no table chosen yet the header keeps its "Table" button for picking one. */
.terminal:has(.servicedock .pos-table-shortcut) .carthead [data-act="tablepick"] { display:none !important; }
/* POS: when an item is tapped, its Plus · Minus · Void · Del buttons get room of their own in the action bar. They used to be squeezed into one button's width and slid underneath Hold, Ticket and Split, so Void could not be found. */
.pos-action-rail .pos-line-actions { max-width:none !important; width:auto !important; }
.pos-action-rail .pos-line-actions > * { max-width:none !important; }
/* The older squeeze rule sits in the "legacy" layer with !important, so this override has to live in that layer too, with a stronger selector. */
@layer legacy { @media (max-width:1180px) {
  .terminalgrid aside.pos-action-rail > .pos-line-actions.pos-line-actions { flex:0 0 auto !important; width:auto !important; padding-inline:0 !important; }
  .terminalgrid aside.pos-action-rail > .pos-line-actions.pos-line-actions > * { flex:0 0 58px !important; min-width:58px !important; }
}
@media (min-width:641px) {
  /* Tablet and wider: there is not room for both groups in one row, so the item buttons take their own row above the others while an item is selected. */
  .terminalgrid aside.pos-action-rail.pos-action-rail:has(> .pos-line-actions) { flex-wrap:wrap !important; }
  .terminalgrid aside.pos-action-rail > .pos-line-actions.pos-line-actions { flex:1 0 100% !important; width:100% !important; }
  .terminalgrid aside.pos-action-rail > .pos-line-actions.pos-line-actions > * { flex:1 1 0 !important; min-width:0 !important; }
} }
@media (max-width:1180px) {
  .terminalgrid aside.pos-action-rail > .pos-line-actions { display:flex !important; gap:4px; padding:0 !important; }
  .terminalgrid aside.pos-action-rail > .pos-line-actions > * { flex:0 0 58px !important; min-width:58px !important; }
}
@media (max-width:640px) {
  .terminalgrid aside.pos-action-rail > .pos-line-actions { grid-column:span 4; display:grid !important; grid-template-columns:repeat(4,minmax(0,1fr)); border:0 !important; }
}
/* Pop-up messages: a new one slides in from the right and fades in; a closed one slides back out. The cards behind glide into place.
   Uses "translate" so it does not fight the stacking "transform". Off when the device asks for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .pos-toast-card { animation:pos-toast-in .26s cubic-bezier(.2,.8,.2,1) both; transition:transform .22s ease, opacity .2s ease; }
  .pos-toast-card.is-leaving { position:absolute; inset:0 0 auto 0; z-index:7; animation:pos-toast-out .2s ease-in both; pointer-events:none; }
  @keyframes pos-toast-in { from { opacity:0; translate:32px 0; } to { opacity:1; translate:0 0; } }
  @keyframes pos-toast-out { from { opacity:1; translate:0 0; } to { opacity:0; translate:32px 0; } }
}
/* Payment screen: the Customer button next to On Account has a person icon and the word Customer. On a phone only the icon shows. */
.pos-payment .payment-tender .payment-account .payment-customer-button { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-width:0; padding-inline:14px; white-space:nowrap; }
.pos-payment .payment-customer-button svg { width:20px; height:20px; flex:none; }
@media (max-width:640px) { .pos-payment .payment-customer-button { padding-inline:12px; } .pos-payment .payment-customer-button span { display:none; } }
/* POS customer picker: the two tabs, the keyboard button and × share one header row with a line under it, and the tabs no longer spill onto the search box.
   (The newer button size made the tabs taller than the old fixed 43px header.) The picker slides up a little and fades in when it opens. */
#modal[open]:has(.pos-customer-workspace) .dialoghead { flex:none; height:auto; min-height:0; align-items:flex-end; gap:8px; padding:10px 12px 0; border-bottom:1px solid var(--line); }
#modal[open]:has(.pos-customer-workspace) .pos-customer-tabs { align-self:stretch; align-items:flex-end; gap:4px; }
#modal[open]:has(.pos-customer-workspace) .pos-customer-tabs button { min-height:44px; margin-bottom:-1px; }
#modal[open]:has(.pos-customer-workspace) .dialoghead > :is([data-act="close"],.pos-keyboard-dialog-trigger) { flex:none; align-self:center; width:40px; min-width:40px; height:40px; min-height:40px; margin:0 0 6px; padding:0; border-radius:50%; }
@media (prefers-reduced-motion: no-preference) {
  #modal[open]:has(.pos-customer-workspace) { animation:pos-sheet-in .24s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes pos-sheet-in { from { opacity:0; translate:0 16px; } to { opacity:1; translate:0 0; } }
}
/* Payment screen: a chosen button (Disc % or Disc Fixed while typing the discount) is teal with white text. The newer button style
   had made its background white while the text stayed white, so the word vanished. */
.pos-payment .payment-key-tools button[aria-pressed="true"], .pos-payment button[aria-pressed="true"] { background:var(--primary); color:var(--on-primary); border-color:var(--primary); }
