/* ---------- mobile app shell (field-capture experience) ----------
   The shell fills the viewport and only .mmain scrolls, so the top and
   bottom bars can never move (avoids iOS fixed-position/rubber-band drift). */
.is-mobile html,
.is-mobile body { overflow: hidden; overscroll-behavior: none; background: var(--bg-2); }
.is-mobile body #app { height: 100%; overflow: hidden; }
.is-mobile body {
  --mobile-content-top-gap: 6px;
  --mobile-page-top-space: calc(4px + var(--mobile-content-top-gap, 0px));
  --mobile-sticky-min-height: 102px;
  --dock-pad-top: 8px;
  --dock-pad-bottom: 10px;
  --dock-safe-trim: 0px;
  --dock-lift: 0px;
}
@media (display-mode: standalone) {
  .is-mobile body {
    --mobile-content-top-gap: 10px;
    --dock-pad-top: 18px;
    --dock-pad-bottom: 2px;
    --dock-safe-trim: 18px;
    --dock-lift: 12px;
  }
  .mtab,
  .mcapture-tab {
    min-height: 52px;
  }
  .mcapture-cluster {
    grid-template-columns: minmax(68px, 80px) 54px;
  }
  .mshutter {
    width: 54px;
    height: 54px;
  }
  .mshutter-ring {
    width: 41px;
    height: 41px;
  }
  .mshutter-ring::after {
    width: 28px;
    height: 28px;
  }
}
.mshell {
  position: fixed; inset: 0; width: 100%; height: auto;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-2);
}
/* Bottom dock — flex child of .mshell. Owns the solid background that fills
   the safe area, the breathing-room padding above/below the nav capsule, and
   the upward content-fade gradient via ::before so the scroll area blends in. */
.mdock {
  flex-shrink: 0;
  position: relative;
  background: var(--bg-2);
  padding: var(--dock-pad-top, 8px) 0 calc(var(--dock-pad-bottom, 10px) + max(env(safe-area-inset-bottom) - var(--dock-safe-trim, 0px), 0px));
}
.mdock::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: 52px;
  background: linear-gradient(to bottom, transparent, var(--bg-2));
  pointer-events: none;
}
.mdock::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: max(env(safe-area-inset-bottom), 0px);
  background: var(--bg-2);
  pointer-events: none;
  z-index: -1;
}
.mtopbar {
  flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 8px calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.mtopbar .logo { padding: 0; }
.mtop-actions { display: flex; align-items: center; gap: 8px; }
.mtopbar,
.mmain,
.mdock {
  position: relative;
  z-index: 1;
}
.mupload-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px;
  background: rgba(108, 124, 255, .11); border: 1px solid rgba(139, 152, 255, .24);
  color: var(--accent-2); font-size: 10.5px; font-weight: 700;
  letter-spacing: .015em; white-space: nowrap;
}
.mupload-chip[hidden] { display: none !important; }
.mupload-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid rgba(139, 152, 255, .26);
  border-top-color: rgba(139, 152, 255, .95);
  animation: mupload-spin .85s linear infinite;
}
@keyframes mupload-spin { to { transform: rotate(360deg); } }
.mreview-link { position: relative; }
.mmain {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: var(--mobile-page-top-space, calc(4px + var(--mobile-content-top-gap, 0px))) calc(16px + env(safe-area-inset-right)) 20px calc(16px + env(safe-area-inset-left));
  max-width: 640px; width: 100%; margin: 0 auto;
  background: var(--bg);
}
.mmain.capture-main {
  overflow: hidden;
}
.mmain.capture-main .cap-screen {
  height: 100%;
  min-height: 100%;
}
.is-mobile .mmain:has(.review-queue-page),
.is-mobile .mmain:has(.mregister-page) {
  padding-top: 0;
  /* Extra tail room so short lists still get comfortable scroll travel
     and the last card can clear the dock fade. */
  padding-bottom: 64px;
}
/* Bottom dock: hero capture capsule on the left, review/register tabs filling the rest.
   Layered glass: gradient fill + hairline border + top sheen + deep soft shadow. */
.mtabbar {
  display: grid; grid-template-columns: auto 1fr 1fr; align-items: stretch; gap: 6px;
  width: min(100% - 28px - env(safe-area-inset-left) - env(safe-area-inset-right), 480px);
  margin: 0 auto;
  transform: translateY(var(--dock-lift, 0px));
  padding: 6px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(34, 39, 54, .55), rgba(16, 19, 28, .35)),
    rgba(20, 24, 33, .9);
  border: 1px solid rgba(255, 255, 255, .08); border-radius: 34px;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, .42),
    0 4px 14px rgba(0, 0, 0, .3),
    inset 0 1px 0 rgba(255, 255, 255, .07);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
}
.mtab {
  position: relative; min-height: 56px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; border-radius: 24px;
  color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .015em;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s ease, background-color .2s ease, transform .15s cubic-bezier(.34, 1.3, .64, 1);
}
.mtab .ic { display: grid; place-items: center; transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.mtab .ic svg { width: 22px; height: 22px; }
.mtab:active { transform: scale(.94); }
.mtab.active {
  color: var(--accent-2);
  background: linear-gradient(180deg, rgba(108, 124, 255, .17), rgba(108, 124, 255, .09));
  box-shadow: inset 0 0 0 1px rgba(139, 152, 255, .16), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.mtab.active .ic { transform: translateY(-1px) scale(1.06); }
.mtab #reviewQueueCount { top: -2px; right: -2px; }
/* Full-width sticky review block (same treatment as register toolbar)
   so the top gap is fully absorbed and cards slide beneath a solid surface. */
.is-mobile .review-queue-page .mreview-sticky {
  position: sticky;
  top: var(--review-sticky-top, 0px);
  z-index: 8;
  min-height: var(--mobile-sticky-min-height, 102px);
  margin-top: 0;
  margin-right: calc(-16px - env(safe-area-inset-right));
  margin-left: calc(-16px - env(safe-area-inset-left));
  margin-bottom: 10px;
  padding: var(--mobile-page-top-space, 0px) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(11, 13, 18, .985), rgba(11, 13, 18, .94));
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.is-mobile .review-queue-page .mreview-sticky .mreview-head {
  margin: 0;
  padding: 0 0 6px;
}
.is-mobile .review-queue-page .mreview-sticky .mphoto-section {
  margin-top: 0;
}
.is-mobile .review-queue-page .mreview-sticky .mphoto-section h3 {
  margin: 0;
  padding: 4px 0 6px;
}
.is-mobile .review-queue-page #reviewPendingBlock {
  position: relative;
  z-index: 1;
}
/* Same fix for register: absorb mmain padding + the register page's own 10px
   padding-top into the toolbar so it covers the full gap when stuck. */
.mregister-page {
  padding-top: 0;
}
.is-mobile .mregister-page .mregister-sticky {
  position: sticky;
  top: 0;
  z-index: 8;
  min-height: var(--mobile-sticky-min-height, 102px);
  margin-top: 0;
  margin-right: calc(-16px - env(safe-area-inset-right));
  margin-left: calc(-16px - env(safe-area-inset-left));
  margin-bottom: 10px;
  padding: var(--mobile-page-top-space, 0px) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(11, 13, 18, .985), rgba(11, 13, 18, .94));
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.mregister-page .mobile-register-toolbar {
  top: 0;
  margin-top: 0;
  padding-top: 0;
}
.mregister-page .mregister-sticky #mobileRegisterMeta {
  padding: 2px 2px 2px;
}
/* Merged capture unit: always reads as one capsule, glows when it's the live route. */
.mcapture-cluster {
  position: relative; display: grid; grid-template-columns: minmax(72px, 84px) 54px; align-items: center; gap: 2px;
  padding: 3px; border-radius: 31px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: background-color .2s ease, box-shadow .25s ease;
}
.mcapture-cluster.active {
  background: linear-gradient(180deg, rgba(108, 124, 255, .2), rgba(108, 124, 255, .08));
  box-shadow:
    inset 0 0 0 1px rgba(139, 152, 255, .32),
    inset 0 1px 0 rgba(255, 255, 255, .1),
    0 0 22px rgba(108, 124, 255, .22);
}
.mcapture-cluster.active .mcapture-tab { color: var(--accent-2); }
.mcapture-tab { min-height: 56px; border-radius: 26px; background: none; box-shadow: none; }
.mcapture-tab.active { background: none; box-shadow: none; }
.mshutter {
  width: 54px; height: 54px; align-self: center; margin: 0;
  display: grid; place-items: center; color: #fff;
  border: none; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .32), transparent 46%),
    linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow:
    0 8px 20px rgba(108, 124, 255, .42),
    0 2px 6px rgba(0, 0, 0, .3),
    inset 0 1px 0 rgba(255, 255, 255, .34),
    inset 0 -2px 6px rgba(0, 0, 0, .18);
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s cubic-bezier(.34, 1.3, .64, 1), box-shadow .2s ease, filter .15s ease;
}
.mshutter svg { width: 25px; height: 25px; }
.mshutter-face { display: grid; place-items: center; }
.mshutter-ring { display: none; width: 45px; height: 45px; border-radius: 50%; border: 3px solid #fff; place-items: center; }
.mshutter-ring::after { content: ""; width: 31px; height: 31px; border-radius: 50%; background: #fff; }
.mshutter.closed {
  box-shadow:
    0 0 0 3px rgba(108, 124, 255, .3),
    0 8px 20px rgba(108, 124, 255, .42),
    inset 0 1px 0 rgba(255, 255, 255, .34),
    inset 0 -2px 6px rgba(0, 0, 0, .18);
}
.mshutter.opening { animation: shutter-pulse 1.1s ease-in-out infinite; }
.mshutter.opening .mshutter-face { opacity: .55; }
@keyframes shutter-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(108, 124, 255, .3), 0 6px 16px rgba(108, 124, 255, .38); }
  50% { box-shadow: 0 0 0 8px rgba(108, 124, 255, .14), 0 6px 16px rgba(108, 124, 255, .38); }
}
.mshutter.live {
  background: linear-gradient(180deg, rgba(30, 34, 46, .98), rgba(18, 21, 30, .98));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .22), 0 6px 16px rgba(0, 0, 0, .35);
}
.mshutter.live .mshutter-face { display: none; }
.mshutter.live .mshutter-ring { display: grid; }
.mshutter.muted {
  color: var(--text-2);
  background: linear-gradient(180deg, rgba(56, 63, 82, .98), rgba(36, 42, 56, .98));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .08);
  filter: saturate(.45);
}
.mshutter:active { transform: scale(.9); filter: brightness(.95); }

@media (prefers-reduced-motion: reduce) {
  .mtab, .mtab .ic, .mshutter, .mcapture-cluster { transition: none; }
  .mshutter.opening { animation: none; }
}
.mmain .toolbar .search { max-width: none; }
/* 16px inputs prevent iOS auto-zoom on focus, regardless of screen width */
.is-mobile .field input, .is-mobile .field textarea, .is-mobile .field select,
.is-mobile .search, .is-mobile .imgcard select { font-size: 16px; }
.is-mobile #toasts { left: 12px; right: 12px; bottom: calc(112px + env(safe-area-inset-bottom)); align-items: center; }
.is-mobile .toast { max-width: min(92vw, 420px); text-align: center; }
/* Capture screen: keep toasts near the lower camera area so the location
   picker/dropdown at the top cannot obscure the message. */
.is-mobile body:has(.capture-main) #toasts {
  top: auto;
  bottom: calc(168px + env(safe-area-inset-bottom));
}