/* Harmonia as an iPhone app (Add to Home Screen). Every rule here applies only when the page runs
   as the installed app (html[data-app=standalone], set by /app.js); the web version is unchanged.
   The page runs under the status bar (black-translucent), so the navy top bars grow by the status-bar
   height and the content keeps clear of the home indicator. Theme colours are not changed. */
html[data-app=standalone] { --app-top: env(safe-area-inset-top, 0px); --app-bottom: env(safe-area-inset-bottom, 0px); --app-left: env(safe-area-inset-left, 0px); --app-right: env(safe-area-inset-right, 0px); }
html[data-app=standalone] body:not(#_#_#_) { padding-left: var(--app-left); padding-right: var(--app-right); padding-bottom: var(--app-bottom); }

/* Status bar: the navy top bar (owner panel, portal) extends under it and stays there when scrolling.
   The public header (sign-in, home) is white in the light theme, so its status-bar strip is brand navy (white status text stays readable). */
html[data-app=standalone] body:not(#_#_#_) :is(.main > .topbar, #portalShell .topbar) { border-top: var(--app-top) solid transparent; }
html[data-app=standalone] body.public-site:not(#_#_#_) .site-header { border-top: var(--app-top) solid #061725; }
/* Menus that open over the page start below the status bar and end above the home indicator. */
html[data-app=standalone] body:not(#_#_#_) #sidebar { border-top: var(--app-top) solid transparent; border-bottom: var(--app-bottom) solid transparent; }
html[data-app=standalone] body:not(#_#_#_) .toast { margin-bottom: var(--app-bottom); }
html[data-app=standalone] body:not(#_#_#_) dialog[open] { max-height: calc(100dvh - var(--app-top) - var(--app-bottom) - 24px); }

/* Portal menu on the phone (seen on iPhone 24 Nov): the perspective name was cut ("Inwestoı") and the
   lock icon of "Zamknij portal" collapsed to a dot. Same text start for all six buttons. */
html:root body:not(#_#_#_) #portalShell .drawer-tools > select.role-select { padding-left: 12px !important; padding-right: 30px !important; background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px !important; }
html:root body:not(#_#_#_) #portalShell .drawer-tools #lockPortal .lock-ico { flex: none; width: 16px; height: 16px; }

/* Sign-in never scrolls (rule of 14 Nov 2026), also in the app, where the status bar and the home indicator
   take up to 93 px: the compact steps of login-fit.css start earlier (iPhone mini and SE sizes). */
@media (max-width: 760px) and (max-height: 820px) {
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card .login-lead { display: none !important; }
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card h1 { font-size: 26px !important; }
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card .public-faq:not([open]) { padding-top: 6px !important; padding-bottom: 0 !important; }
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card .public-faq:not([open]) > summary { padding: 4px 0 !important; min-height: 0 !important; }
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card .login-followup-actions .button { min-height: 36px !important; height: 36px !important; }
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card .access-status { padding: 6px 10px !important; }
}
@media (max-width: 760px) and (max-height: 700px) {
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card { padding: 14px 16px !important; }
  html[data-app=standalone] body.login-site:not(#_#_#_) .login-card :is(.form-field, .passkey-actions, .login-request, .login-followup-actions, .public-faq, .access-status) { margin-top: 8px !important; }
}

/* Touch targets on the phone (audit A3, 25 Nov 2026): at least 44 x 44 px, as Apple asks. Sizes only, the same words.
   Sign-in footer links (Contact, Privacy, Cookies): the touch area grows upwards into the footer's own space, so the
   words, the footer line and the page height stay where they were (the sign-in never scrolls). */
@media (max-width: 760px) {
  html:root body.login-site:not(#_#_#_):not(#_#_#_) .site-footer .footer-links > .button { min-height: 44px !important; box-sizing: border-box !important; display: inline-flex !important; align-items: flex-end !important; margin-top: -25px !important; }
}
/* Investor portal on the phone, all four perspectives: the control scale of scale-2026.css is 44 px (menu, language,
   theme and the page buttons). */
@media (max-width: 640px) {
  html:root body:not(#_#_#_) #portalShell { --ctl-bar: 44px; --ctl-std: 44px; --ctl-sm: 44px; }
  html:root body:not(#_#_#_) #portalShell .topbar :is(.mobile-menu-btn, .lang-button, .theme-toggle) { min-width: 44px !important; min-height: 44px !important; }
  html:root body:not(#_#_#_) #portalShell .page-content :is(.secondary-button, .action-button).small { min-width: 44px !important; }
  html:root body:not(#_#_#_) .sidebar-foot .terms-view-link { min-height: 44px; display: flex; align-items: center; margin-top: 0; }
}
