/* Installable app: the update note, the install note for phones, the iPhone steps, and the fit inside the installed app's window.
   Colours come from the app's own theme (light, dark) with plain fallbacks. */
.pwa-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 9000; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 460px);
  background: var(--obsidian, #111214); color: #fff; border: 1px solid var(--obsidian-line, #2A2B31); border-radius: 14px; padding: 10px 10px 10px 16px; font-size: .88rem; box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.pwa-toast-btn { font: inherit; font-weight: 700; background: var(--gold, #C6A15B); color: #17181B; border: 0; border-radius: 10px; padding: 8px 14px; min-height: 36px; cursor: pointer; }
.pwa-toast-x { font: inherit; font-size: 1.2rem; line-height: 1; background: transparent; color: #cfcfcf; border: 0; padding: 6px 8px; min-height: 36px; cursor: pointer; }
@media (min-width: 900px) { .pwa-toast { bottom: 24px; } }

.pwa-banner { position: fixed; left: 10px; right: 10px; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); z-index: 45; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  background: var(--surface, #fff); color: var(--ink, #141518); border: 1px solid var(--gold-line, #EFE3C8); border-radius: 16px; box-shadow: 0 10px 30px rgba(17,18,20,.18); }
.pwa-banner-ic { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.pwa-banner-tx { flex: 1 1 auto; min-width: 0; font-size: .85rem; font-weight: 600; line-height: 1.3; }
.pwa-banner-go { flex: none; font: inherit; font-size: .85rem; font-weight: 700; background: var(--dark, #141518); color: var(--on-dark, #fff); border: 0; border-radius: 10px; padding: 9px 14px; min-height: 40px; cursor: pointer; }
.pwa-banner-x { flex: none; font: inherit; font-size: 1.3rem; line-height: 1; background: transparent; color: var(--muted, #5C5E66); border: 0; padding: 6px 10px; min-width: 40px; min-height: 40px; cursor: pointer; }
@media (min-width: 900px) { .pwa-banner { display: none; } }

.pwa-overlay { position: fixed; inset: 0; z-index: 9500; display: flex; align-items: flex-end; justify-content: center; background: rgba(10,10,12,.55); padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.pwa-sheet { width: 100%; max-width: 420px; background: var(--surface, #fff); color: var(--ink, #141518); border-radius: 20px; padding: 22px 20px 20px; box-shadow: 0 24px 60px rgba(0,0,0,.35); max-height: 90vh; overflow-y: auto; }
.pwa-sheet h2 { margin: 0 0 6px; font-size: 1.2rem; }
.pwa-sheet-sub { margin: 0 0 16px; color: var(--muted, #5C5E66); font-size: .9rem; line-height: 1.45; }
.pwa-steps { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.pwa-steps li { display: flex; gap: 14px; align-items: flex-start; }
.pwa-step-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; background: var(--gold-wash, #FBF7EE); color: var(--gold-ink, #8A6A2E); border: 1px solid var(--gold-line, #EFE3C8); }
.pwa-step-tx { font-size: .9rem; line-height: 1.45; color: var(--text, #26272C); }
.pwa-step-tx b { color: var(--ink, #141518); }
.pwa-sheet-done { width: 100%; min-height: 48px; font-size: 1rem; }
@media (min-width: 900px) { .pwa-overlay { align-items: center; } }

/* Only inside the installed app's own window (phone home-screen app, or the laptop app window): keep clear of the notch, the rounded corners and the home bar.
   In a normal browser tab nothing here applies, so browsing looks exactly as before. */
@media (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  html, body { overscroll-behavior-y: none; }
  body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .bottom-nav, .es-bottom, .admin-bottom { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .toast-stack { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); right: calc(20px + env(safe-area-inset-right, 0px)); }
  .pwa-toast, .pwa-banner { margin-left: env(safe-area-inset-left, 0px); }
}

/* The owner's menu on a phone: the account menu (My profile, Install app, Log out) opens from the card at the bottom of the slide-in menu, but it was drawn
   underneath that slide-in menu and could not be seen. While it is open, its bar is lifted above the slide-in menu. Phones only; nothing else changes. */
@media (max-width: 899.98px) {
  body[data-mode="admin"].sidebar-open .topbar:has(#user-menu:not([hidden])) { z-index: 80; }
}
