/* ProBill QP383 — cross-device baseline for iOS Safari, iPadOS and mobile browsers.
   Loaded last so older engines receive explicit fallbacks for critical layout. */
html {
  width: 100%;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  max-width: 100%;
  min-width: 320px;
}
body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}
button,
a,
input,
select,
textarea,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.app-shell,
.app-main,
.page-content,
.page-content > *,
.page-content .panel,
.page-content .panel > *,
.page-content .form-grid,
.page-content .cards,
.page-content .grid-two,
.page-content .filters,
.page-content .section-grid {
  min-width: 0;
  max-width: 100%;
}
.app-shell {
  width: 100%;
  min-height: 100vh;
}
.app-main {
  width: auto;
  min-height: 100vh;
}
.page-content {
  width: 100%;
  overflow-wrap: anywhere;
}
.page-content .table-wrap,
.page-content .table-responsive,
.page-content .report-table-wrap,
.page-content [data-table-scroll] {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.page-content input,
.page-content select,
.page-content textarea,
.auth-card input,
.auth-card select,
.auth-card textarea {
  max-width: 100%;
}

/* Login / owner setup: stable two-panel desktop and one-panel tablet/phone. */
body.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 0;
  overflow-x: hidden;
  align-items: stretch;
}
body.auth-page .auth-showcase {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
body.auth-page .auth-card {
  width: 100%;
  max-width: 492px;
  min-width: 0;
  max-height: none;
  overflow: visible;
  align-self: center;
  justify-self: center;
  margin: 18px auto;
}
body.auth-page .auth-form,
body.auth-page .auth-input-label,
body.auth-page .auth-password {
  min-width: 0;
  max-width: 100%;
}
body.auth-page .auth-form input[type="email"],
body.auth-page .auth-form input[type="password"],
body.auth-page .auth-form input[type="text"],
body.auth-page .auth-form select,
body.auth-page .auth-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  font-size: 16px;
  line-height: 1.35;
  -webkit-appearance: none;
  appearance: none;
}
body.auth-page .auth-form .primary-btn,
body.auth-page .auth-form button[type="submit"] {
  min-height: 48px;
  width: 100%;
}
body.auth-page .auth-password .password-toggle {
  min-width: 44px;
  min-height: 44px;
  touch-action: manipulation;
}
body.auth-page .auth-session-note {
  min-width: 0;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
body.auth-page .auth-footer {
  overflow-wrap: anywhere;
}

@media screen and (min-width: 861px) and (max-width: 1100px) {
  body.auth-page {
    grid-template-columns: minmax(0, 1fr) minmax(390px, .98fr);
  }
  body.auth-page .auth-showcase {
    padding: 28px;
  }
  body.auth-page .auth-card {
    width: calc(100% - 28px);
    max-width: 470px;
    padding: 26px;
  }
}
@media screen and (max-width: 860px) {
  body.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    padding: 18px 16px;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    background: #f3f7fd;
    background: var(--body-bg, #f3f7fd);
    place-items: center;
  }
  body.auth-page .auth-showcase {
    display: none;
  }
  body.auth-page .auth-card {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    max-width: 492px;
    margin: auto;
    max-height: none;
    overflow: visible;
    padding: 28px 26px;
  }
}
@media screen and (max-width: 620px) {
  body.auth-page {
    padding: 14px 12px;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    padding-left: max(12px, env(safe-area-inset-left));
  }
  body.auth-page .auth-card {
    padding: 23px 19px;
    border-radius: 18px;
  }
  body.auth-page .auth-card h1 {
    font-size: 25px;
    line-height: 1.22;
  }
  body.auth-page .auth-form {
    gap: 13px;
  }
  body.auth-page .auth-form .auth-input-label {
    font-size: 13px;
  }
  body.auth-page .auth-session-note {
    justify-content: space-between;
  }
  body.auth-page .auth-currency-choices {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media screen and (max-width: 380px) {
  body.auth-page {
    padding: 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
  }
  body.auth-page .auth-card {
    padding: 20px 15px;
    border-radius: 16px;
  }
  body.auth-page .auth-card h1 {
    font-size: 23px;
  }
  body.auth-page .auth-brand {
    margin-bottom: 18px;
  }
  body.auth-page .auth-currency-choices {
    gap: 5px;
  }
  body.auth-page .auth-session-note {
    font-size: 11px;
  }
}

/* Authenticated workspace: retain the existing navigation breakpoints but stop
   flex/grid children and tables from forcing the whole viewport wider. */
@media screen and (max-width: 1000px) {
  .app-main,
  .sidebar-collapsed .app-main {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100%;
  }
  .app-header {
    padding-left: 14px;
    padding-right: 14px;
  }
  .page-content {
    width: 100%;
    padding-left: 14px;
    padding-right: 14px;
  }
}
@media screen and (max-width: 680px) {
  .app-header {
    padding-left: 12px;
    padding-right: 12px;
  }
  .page-content {
    padding: 14px 10px 28px;
  }
  .page-content input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  .page-content select,
  .page-content textarea {
    font-size: 16px !important;
    max-width: 100%;
  }
  .page-content .form-grid,
  .page-content .grid-two,
  .page-content .purchase-form-top,
  .page-content .dashboard-grid {
    min-width: 0;
    max-width: 100%;
  }
  .page-content .form-actions,
  .page-content .page-actions {
    flex-wrap: wrap;
  }
  .page-content .primary-btn,
  .page-content .secondary-btn,
  .page-content button,
  .page-content [role="button"] {
    touch-action: manipulation;
  }
}
@media screen and (max-width: 380px) {
  .app-header {
    padding-left: 9px;
    padding-right: 9px;
  }
  .page-content {
    padding-left: 8px;
    padding-right: 8px;
  }
  .page-content .panel {
    padding-left: 12px;
    padding-right: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.auth-page *,
  body.auth-page *::before,
  body.auth-page *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}


/* QP384 — restore the intended bounded authentication card.
   QP307 theme rules use :root[data-pb-theme] body.auth-page .auth-card and
   previously overrode the lower-specificity QP383 max-width on wide screens.
   Matching that selector here (loaded afterwards) ensures the width cap wins. */
:root[data-pb-theme] body.auth-page .auth-card {
  width:min(492px,calc(100% - 32px));
  max-width:492px;
  min-width:0;
  box-sizing:border-box;
  justify-self:center;
  align-self:center;
  margin:16px auto;
}
:root[data-pb-theme] body.auth-page.owner-setup-page .auth-card {
  width:min(510px,calc(100% - 32px));
  max-width:510px;
}
@media screen and (max-width:860px) {
  :root[data-pb-theme] body.auth-page {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    align-content:center;
    justify-items:center;
    min-height:100vh;
    min-height:100svh;
    min-height:100dvh;
    padding-top:max(18px,env(safe-area-inset-top));
    padding-right:max(16px,env(safe-area-inset-right));
    padding-bottom:max(18px,env(safe-area-inset-bottom));
    padding-left:max(16px,env(safe-area-inset-left));
  }
  :root[data-pb-theme] body.auth-page .auth-card {
    grid-column:1;
    grid-row:1;
    width:min(492px,100%);
    max-width:492px;
    max-height:none;
    overflow:visible;
    margin:0 auto;
  }
  :root[data-pb-theme] body.auth-page.owner-setup-page .auth-card {
    width:min(510px,100%);
    max-width:510px;
  }
}
@media screen and (max-width:620px) {
  :root[data-pb-theme] body.auth-page {
    padding-top:max(14px,env(safe-area-inset-top));
    padding-right:max(12px,env(safe-area-inset-right));
    padding-bottom:max(14px,env(safe-area-inset-bottom));
    padding-left:max(12px,env(safe-area-inset-left));
  }
  :root[data-pb-theme] body.auth-page .auth-card {
    width:100%;
    max-width:492px;
    padding:23px 19px;
    border-radius:18px;
  }
  :root[data-pb-theme] body.auth-page .auth-form input:is([type="email"],[type="password"],[type="text"],select,textarea) {
    font-size:16px;
  }
  :root[data-pb-theme] body.auth-page .auth-form .primary-btn,
  :root[data-pb-theme] body.auth-page .auth-password .password-toggle {
    min-height:46px;
  }
}
@media screen and (max-width:380px) {
  :root[data-pb-theme] body.auth-page .auth-card {
    padding:20px 15px;
    border-radius:16px;
  }
  :root[data-pb-theme] body.auth-page .auth-card h1 {
    font-size:23px;
    line-height:1.22;
  }
  :root[data-pb-theme] body.auth-page .auth-session-note {
    gap:7px;
    font-size:11px;
  }
}
@media screen and (max-height:560px) and (max-width:860px) {
  :root[data-pb-theme] body.auth-page {align-content:start;}
  :root[data-pb-theme] body.auth-page .auth-card {margin:4px auto;}
}
