/* The cashier is a bounded POS workspace; administration keeps its page layout. */
@media screen {
  body.cashier-session {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  #app[data-role="cashier"] {
    position: absolute;
    inset-inline: 0;
    top: var(--visual-top, 0px);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: min(var(--visual-height, 100dvh), var(--screen-height, 100dvh));
    min-height: 0;
    overflow: hidden;
    background: #f6f7fb;
  }

  #app[data-role="cashier"] .cashier-header {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 12px;
    min-height: calc(64px + env(safe-area-inset-top, 0px));
    padding: calc(8px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 8px max(14px, env(safe-area-inset-left, 0px));
    border-bottom: 1px solid #e1e4ec;
    background: #fff;
  }
  #app[data-role="cashier"] .cashier-header > .icon-button { flex: 0 0 44px; border-color: #e5e1ee; background: #f8f6fc; }
  #app[data-role="cashier"] .cashier-brand { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
  #app[data-role="cashier"] .cashier-brand .bizzy-wordmark { font-size: 1.6rem; }
  #app[data-role="cashier"] .cashier-shop { flex: 1; min-width: 0; color: #697286; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #app[data-role="cashier"] .cashier-connection {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    gap: 7px;
    min-width: 44px;
    min-height: 44px;
    max-width: 220px;
    margin-inline-start: auto;
    padding: 8px 12px;
    border: 1px solid #d9e9df;
    border-radius: 10px;
    background: #f0f8f3;
    color: #287251;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #app[data-role="cashier"] .cashier-connection::before { content: ''; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: currentColor; }
  #app[data-role="cashier"] .cashier-connection[data-status="offline"],
  #app[data-role="cashier"] .cashier-connection[data-status="pending"],
  #app[data-role="cashier"] .cashier-connection[data-status="attention"] { color: #8a5a13; background: #fff7e7; border-color: #efdfbd; }
  #app[data-role="cashier"] .cashier-connection[data-status="syncing"] { color: #6046aa; background: #f2edfc; border-color: #dfd5f3; }
  #app[data-role="cashier"] .cashier-connection > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #app[data-role="cashier"] #cashier-attention:not([hidden]) {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 7px max(14px, env(safe-area-inset-right, 0px)) 7px max(14px, env(safe-area-inset-left, 0px));
    border: 0;
    border-bottom: 1px solid #ecd69f;
    border-radius: 0;
    background: #fff5dc;
    color: #785016;
    font-size: 13px;
    text-align: start;
  }
  #app[data-role="cashier"] #cashier-attention[hidden] { display: none !important; }
  #app[data-role="cashier"] .storage-alert { flex: 0 0 auto; margin: 0; padding: 7px 14px; font-size: 13px; }

  #app[data-role="cashier"] .workspace {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    width: 100%;
    height: auto;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 12px max(12px, env(safe-area-inset-right, 0px)) 12px max(12px, env(safe-area-inset-left, 0px));
    gap: 14px;
    overflow: hidden;
  }
  #app[data-role="cashier"] .menu-panel {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }
  #app[data-role="cashier"] .menu-toolbar { display: block; flex: 0 0 auto; min-height: 0; padding-bottom: 10px; }
  #app[data-role="cashier"] .menu-toolbar .search-field { width: 100%; min-height: 44px; height: 44px; }
  #app[data-role="cashier"] .menu-body { display: flex; flex: 1 1 0; flex-direction: column; min-height: 0; min-width: 0; gap: 10px; overflow: hidden; }
  #app[data-role="cashier"] .category-rail {
    display: flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    max-height: none;
    padding: 4px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  #app[data-role="cashier"] .category-button { flex: 0 0 auto; min-width: 76px; min-height: 60px; padding: 7px 10px; gap: 4px; font-size: 12px; }
  #app[data-role="cashier"] .category-button svg { width: 20px; height: 20px; }
  #app[data-role="cashier"] .catalog {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    padding-inline: 2px 5px;
    padding-bottom: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  #app[data-role="cashier"] .catalog-meta { margin: 0; padding: 0 1px 9px; font-size: 12px; }
  #app[data-role="cashier"] .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  #app[data-role="cashier"] .product-tile { min-height: 130px; padding: 13px 11px 11px; }
  #app[data-role="cashier"] .product-name { font-size: 15px; }
  #app[data-role="cashier"] .price { font-size: 15px; }
  #app[data-role="cashier"] .product-meta { gap: 4px 6px; padding-top: 16px; }
  #app[data-role="cashier"] .suggestions-heading { margin-top: 16px; }

  #app[data-role="cashier"] .order-panel {
    display: none;
    flex: 1 1 0;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: none;
    min-width: 0;
    min-height: 0;
    margin: 0;
    overflow: hidden;
  }
  #app[data-role="cashier"][data-mobile-view="cart"] .menu-panel { display: none; }
  #app[data-role="cashier"][data-mobile-view="cart"] .order-panel { display: flex; }
  #app[data-role="cashier"] .order-heading { flex: 0 0 auto; padding: 10px 12px; }
  #app[data-role="cashier"] .table-label { font-size: 16px; }
  #app[data-role="cashier"] .order-id { font-size: 11px; }
  #app[data-role="cashier"] .order-tools { gap: 5px; }
  #app[data-role="cashier"] .actions-button { font-size: 13px; padding: 8px; }
  #app[data-role="cashier"] .dropdown-menu { max-height: min(300px, calc(var(--visual-height, 100dvh) - 190px)); overflow-y: auto; overscroll-behavior: contain; }
  #app[data-role="cashier"] .customer-button { flex: 0 0 auto; margin: 6px 12px 0; min-height: 44px; padding-block: 7px; font-size: 13px; }
  #app[data-role="cashier"] .cart-header { flex: 0 0 auto; padding: 9px 12px; font-size: 12px; }
  #app[data-role="cashier"] .cart-list {
    flex: 1 1 0;
    min-height: 0;
    padding-inline: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  #app[data-role="cashier"] .cart-item { padding-block: 11px; }
  #app[data-role="cashier"] .cart-item-name { font-size: 14px; }
  #app[data-role="cashier"] .cart-item-price { font-size: 12px; }
  #app[data-role="cashier"] .cart-list .empty-state { min-height: 0; padding: 20px 8px; }
  #app[data-role="cashier"] .tax-inline { padding: 9px 0; }
  #app[data-role="cashier"] .order-bottom { flex: 0 0 auto; margin-top: 0; padding: 10px 12px 12px; border-top: 1px solid #e7e4ee; background: #fff; }
  #app[data-role="cashier"] .cashier-total-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
  #app[data-role="cashier"] .cashier-total-line button { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 44px; gap: 1px; padding: 0; border: 0; background: transparent; text-align: start; font-size: 14px; }
  #app[data-role="cashier"] .cashier-total-line small { display: block; color: #697286; font-size: 11px; font-weight: 400; }
  #app[data-role="cashier"] .cashier-total-line > strong { font-size: clamp(21px, 2.3vw, 28px); font-variant-numeric: tabular-nums; white-space: nowrap; }
  #app[data-role="cashier"] .cashier-total-line > strong small { display: inline; font-size: 12px; }
  #app[data-role="cashier"] .cashier-checkout-row { display: grid; grid-template-columns: minmax(100px, .85fr) minmax(0, 1.5fr); gap: 8px; }
  #app[data-role="cashier"] .cashier-payment-method { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 50px; gap: 7px; padding: 10px 8px; border: 1px solid #ded7eb; border-radius: 9px; background: #f8f6fc; color: #6044a0; font-size: 13px; }
  #app[data-role="cashier"] .cashier-payment-method > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #app[data-role="cashier"] .cashier-payment-method svg { width: 18px; height: 18px; }
  #app[data-role="cashier"] .cashier-checkout-row .checkout-button { min-width: 0; min-height: 50px; padding: 10px 12px; font-size: 15px; justify-content: center; }
  #app[data-role="cashier"] .cashier-checkout-row .checkout-button > span { justify-content: center; }

  #app[data-role="cashier"] .compact-nav {
    position: static;
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 8px;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    box-shadow: none;
    z-index: auto;
  }
  #app[data-role="cashier"] .compact-nav button { min-height: 46px; padding: 8px 10px; }
  #app[data-role="cashier"] > .admin-content,
  #app[data-role="cashier"] > .register-closed { flex: 1 1 0; min-height: 0; padding-bottom: max(20px, env(safe-area-inset-bottom, 0px)); overflow-y: auto; overscroll-behavior: contain; }
  body.cashier-session .toast-container { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  /* Native dialog gives the navigation its own focus and scroll boundary. */
  body.cashier-session .cashier-drawer {
    position: fixed;
    inset-block-start: var(--visual-top, 0px);
    inset-block-end: auto;
    inset-inline-start: 0;
    inset-inline-end: auto;
    width: min(390px, calc(100% - 24px));
    max-width: none;
    height: min(var(--visual-height, 100dvh), var(--screen-height, 100dvh));
    max-height: none;
    margin: 0;
    padding: 0 0 max(12px, env(safe-area-inset-bottom, 0px));
    border: 0;
    border-inline-end: 1px solid #e1e4ec;
    border-radius: 0;
    background: #fff;
    color: #242538;
    box-shadow: 0 0 50px #25233830;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.cashier-session .cashier-drawer[open] { display: flex; flex-direction: column; }
  body.cashier-session .cashier-drawer::backdrop { background: #25233855; backdrop-filter: blur(3px); }
  body.cashier-session .cashier-drawer > * { flex: 0 0 auto; min-width: 0; }
  body.cashier-session .cashier-drawer-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px; border-bottom: 1px solid #e9e5f0; background: #fff; }
  body.cashier-session .cashier-drawer-header h2 { font-size: 17px; }
  body.cashier-session .cashier-drawer-header .bizzy-wordmark { font-size: 1.55rem; }
  body.cashier-session .cashier-drawer-header .icon-button { border-color: #e5e1ee; }
  body.cashier-session .cashier-drawer-profile { display: flex; align-items: center; gap: 12px; margin: 16px; padding: 14px; border: 1px solid #e7e0f3; border-radius: 12px; background: #f8f5fd; }
  body.cashier-session .cashier-drawer-profile > div { min-width: 0; }
  body.cashier-session .cashier-drawer-profile strong { display: block; overflow-wrap: anywhere; }
  body.cashier-session .cashier-drawer-profile small { display: block; margin-top: 3px; color: #697286; font-size: 12px; overflow-wrap: anywhere; }
  body.cashier-session .cashier-menu-links { display: grid; gap: 4px; padding: 0 16px 14px; }
  body.cashier-session .cashier-menu-links button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; background: #fff; text-align: start; font-size: 15px; }
  body.cashier-session .cashier-menu-links button:hover { background: #f6f3fc; }
  body.cashier-session .cashier-menu-links button[aria-current="page"] { background: #eee8fc; border-color: #e0d6f6; color: #6843bd; font-weight: 600; }
  body.cashier-session .cashier-menu-links .danger-text { margin-top: 5px; }
  body.cashier-session .cashier-drawer-settings { padding: 16px; border-top: 1px solid #e9e5f0; }
  body.cashier-session .cashier-drawer-settings .language-switcher { width: 100%; margin: 0; }
  body.cashier-session .cashier-drawer-settings .language-switcher button { flex: 1; min-height: 44px; }
  body.cashier-session .cashier-drawer-settings > small { display: block; margin-top: 14px; color: #697286; font-size: 12px; }
  body.cashier-session .cashier-drawer .offline-banner { flex-direction: column; align-items: stretch; margin: 0 16px 16px; padding: 12px; border: 1px solid #d7e9df; border-radius: 10px; font-size: 13px; }
  body.cashier-session .cashier-drawer .offline-banner.needs-attention { border-color: #efdfbd; }
  body.cashier-session .cashier-drawer-settings .offline-banner { margin: 16px 0 0; }
  body.cashier-session .cashier-drawer .offline-banner > div:first-child { gap: 7px; }
  body.cashier-session .cashier-drawer .offline-banner span { font-size: 12px; line-height: 1.7; }
  body.cashier-session .cashier-drawer .offline-actions { flex-wrap: wrap; gap: 8px; }
  body.cashier-session .cashier-drawer .offline-actions button { flex: 1; min-height: 44px; padding-inline: 8px; font-size: 12px; }
  body.cashier-session #modal .payment-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.cashier-session #modal .payment-method { min-width: 0; min-height: 56px; justify-content: flex-start; padding: 11px; text-align: start; }
  body.cashier-session #modal .payment-method > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  body.cashier-session #modal .payment-method .selection-dot { flex: 0 0 auto; }

  @media (min-width: 520px) {
    #app[data-role="cashier"] .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (min-width: 700px) {
    #app[data-role="cashier"] .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
  @media (min-width: 900px) {
    #app[data-role="cashier"] .workspace { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 35%, 460px); padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
    #app[data-role="cashier"][data-mobile-view] .menu-panel,
    #app[data-role="cashier"][data-mobile-view] .order-panel { display: flex; min-height: 0; }
    #app[data-role="cashier"] .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    #app[data-role="cashier"] .compact-nav { display: none; }
    body.cashier-session .toast-container { bottom: max(20px, env(safe-area-inset-bottom, 0px)); }
  }
  @media (min-width: 1200px) {
    #app[data-role="cashier"] .workspace { gap: 18px; padding-top: 16px; padding-inline: 18px; }
    #app[data-role="cashier"] .menu-body { flex-direction: row; gap: 12px; }
    #app[data-role="cashier"] .category-rail { flex-direction: column; width: 82px; max-height: 100%; overflow-x: hidden; overflow-y: auto; }
    #app[data-role="cashier"] .category-button { flex: 0 0 auto; width: 100%; min-width: 0; min-height: 68px; padding-inline: 5px; }
    #app[data-role="cashier"] .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
  @media (min-width: 1500px) {
    #app[data-role="cashier"] .product-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    #app[data-role="cashier"] .product-tile { min-height: 145px; }
  }
  @media (max-width: 519px) {
    #app[data-role="cashier"] .cashier-header { gap: 8px; min-height: calc(60px + env(safe-area-inset-top, 0px)); padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
    #app[data-role="cashier"] .cashier-brand .bizzy-wordmark { font-size: 1.35rem; }
    #app[data-role="cashier"] .cashier-shop { display: none; }
    #app[data-role="cashier"] .cashier-connection { max-width: 140px; padding-inline: 9px; font-size: 11px; }
    #app[data-role="cashier"] .compact-nav button { font-size: 13px; }
    #app[data-role="cashier"] .compact-nav button strong { font-size: 14px; }
  }
  @media (max-width: 359px) {
    #app[data-role="cashier"] .cashier-brand .bizzy-wordmark { font-size: 1.2rem; }
    #app[data-role="cashier"] .cashier-connection { max-width: 112px; padding-inline: 7px; }
    #app[data-role="cashier"] .workspace { padding-inline: 8px; }
    #app[data-role="cashier"] .product-tile { padding-inline: 9px; }
    #app[data-role="cashier"] .cashier-total-line > strong { font-size: 21px; }
    #app[data-role="cashier"] .compact-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr); padding-inline: 8px; }
    #app[data-role="cashier"] .compact-nav button { padding-inline: 6px; gap: 5px; }
  }
  @media (max-height: 540px) {
    #app[data-role="cashier"] .cashier-header { min-height: calc(52px + env(safe-area-inset-top, 0px)); padding-block: calc(4px + env(safe-area-inset-top, 0px)) 4px; }
    #app[data-role="cashier"] .workspace { padding-block: 8px; gap: 10px; }
    #app[data-role="cashier"] .menu-toolbar { padding-bottom: 6px; }
    #app[data-role="cashier"] .menu-body { gap: 6px; }
    #app[data-role="cashier"] .category-button { flex-direction: row; min-height: 44px; gap: 6px; }
    #app[data-role="cashier"] .category-rail { padding: 2px; }
    #app[data-role="cashier"] .catalog-meta { padding-bottom: 5px; }
    #app[data-role="cashier"] .product-tile { min-height: 108px; }
    #app[data-role="cashier"] .product-meta { padding-top: 8px; }
    #app[data-role="cashier"] .order-heading { padding-block: 3px; }
    #app[data-role="cashier"] .order-id { display: none; }
    #app[data-role="cashier"] .customer-button { margin-block: 0; }
    #app[data-role="cashier"] .cart-header { display: none; }
    #app[data-role="cashier"] .order-bottom { padding-block: 4px 8px; }
    #app[data-role="cashier"] .cashier-total-line { margin-bottom: 2px; }
    #app[data-role="cashier"] .cashier-total-line > strong { font-size: 22px; }
    #app[data-role="cashier"] .cashier-checkout-row .checkout-button,
    #app[data-role="cashier"] .cashier-payment-method { min-height: 44px; padding-block: 8px; }
    #app[data-role="cashier"] .compact-nav { padding-block: 4px calc(4px + env(safe-area-inset-bottom, 0px)); }
    #app[data-role="cashier"] .compact-nav button { min-height: 44px; padding-block: 6px; }
  }
}

@media print {
  body.cashier-session { position: static; width: auto; height: auto; overflow: visible !important; }
  #app[data-role="cashier"], .cashier-drawer { display: none !important; }
}
