/* The app shell for MEApp and ME Tech: a real full-screen page instead of the
   blueprint's phone frame. Same tokens, same glass; the screen scrolls, the
   taskbar floats at the bottom, Browse slides in from the right. */

html, body { height: 100%; }
body.mx { margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body.mx .page-aurora { position: fixed; inset: 0; z-index: 0; }

/* the screen */
#view.scr { position: fixed; inset: 0; z-index: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(124px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  overscroll-behavior: contain; }
#view.scr > .page { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
#view.scr > .page.wide { max-width: 1180px; }
#view.scr.bare { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (prefers-reduced-motion: no-preference) { #view .page.enter { animation: enter .5s var(--ease) both; } }

/* taskbar */
body.mx .dock { position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
body.mx .dock .tbar { max-width: 460px; }
body.mx.signed-out .dock, body.mx.signed-out .sosb { display: none; }

/* Browse */
body.mx .scrim { position: fixed; }
body.mx .side { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.side .nv svg { width: 20px; height: 20px; }
.side .me .av { width: 40px; height: 40px; font-size: 15px; }

/* sheets: one card that rises from the bottom */
.sheetwrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 0 8px; }
.sheetwrap .scrim { opacity: 1; pointer-events: auto; z-index: 0; }
.sheet { position: relative; z-index: 1; width: 100%; max-width: 640px; max-height: calc(100% - 40px - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain;
  border-radius: 34px 34px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; scrollbar-width: none; }
.sheet::before { content: ""; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--fill-2); flex: 0 0 auto; }
.sheet .shd { display: flex; align-items: center; gap: 12px; }
.sheet .shd h3 { flex: 1; font-size: 22px; }
.sheet .x, .icon-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: rise .45s var(--ease) both; } .sheetwrap .scrim { animation: fadein .3s both; } }
@keyframes rise { from { transform: translateY(40%); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }
@media (min-width: 700px) { .sheetwrap { align-items: center; } .sheet { border-radius: 34px; padding-bottom: 24px; } }

/* full-screen layers (SOS, scanner) */
.layer { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(18px + env(safe-area-inset-bottom, 0px));
  background: rgba(5, 8, 20, .34); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }
.layer > .sosbox { max-width: 460px; }

/* toast */
#toast { position: fixed; z-index: 90; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 18px; font-size: 15px; font-weight: 600; transition: opacity .25s, transform .35s var(--spring); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { color: var(--bad); }
#toast.good { color: var(--ok); }

/* forms */
.fld select { font: inherit; font-size: 16px; color: var(--ink); background: var(--glass-thick); border: 1px solid var(--edge); border-radius: 16px; min-height: 52px; padding: 0 14px; box-shadow: var(--shadow); width: 100%; }
.fld input, .fld textarea { width: 100%; }
.fld .hint { font-size: 13px; color: var(--ink-3); }
.fld .err { font-size: 13px; color: var(--bad); }
.otp-in { letter-spacing: .5em; text-align: center; font: 700 26px var(--mono) !important; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnrow > .btn { flex: 1 1 140px; }

/* bits */
.empty { text-align: center; color: var(--ink-3); padding: 28px 8px; font-size: 15px; }
.skel { border-radius: 22px; background: linear-gradient(90deg, var(--fill) 0, var(--fill-2) 50%, var(--fill) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.kv2 small { display: block; font-size: 12.5px; color: var(--ink-3); }
.kv2 b { font-size: 15.5px; color: var(--title); font-weight: 650; overflow-wrap: anywhere; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.tap { cursor: pointer; }
.list > button.row { border: 0; background: none; text-align: left; width: 100%; font: inherit; color: inherit; cursor: pointer; }
.badge { min-width: 22px; height: 22px; border-radius: 11px; padding: 0 7px; background: var(--bad-f); color: #fff; font: 700 12px/22px var(--font); text-align: center; }
.lt .sosb { flex: 0 0 auto; }
.big.sm { font-size: 30px; }
.line { height: 1px; background: var(--line); }
.mono-s { font: 500 12.5px var(--mono); color: var(--ink-3); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos .ph { width: 72px; height: 72px; border-radius: 16px; background: var(--fill) center/cover no-repeat; position: relative; }
.photos .add { width: 72px; height: 72px; border-radius: 16px; border: 1.5px dashed var(--line-2); background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.qrbox { background: #fff; border-radius: 12px; padding: 6px; display: grid; place-items: center; }
.qrbox img, .qrbox svg { display: block; width: 100%; height: auto; image-rendering: pixelated; }

/* scanner */
.scanner { position: relative; width: 100%; max-width: 420px; aspect-ratio: 3 / 4; border-radius: 30px; overflow: hidden; background: #0B0F18; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; left: 50%; top: 50%; width: 62%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 26px; border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scanner .msg { position: absolute; left: 12px; right: 12px; bottom: 12px; text-align: center; color: #fff; font-size: 14px; font-weight: 600; }

/* SOS map (Leaflet) */
.sosmap .leaf { position: absolute; inset: 0; }
.sosmap .leaflet-container { background: var(--fill); font-family: var(--font); }
.sosmap .eta, .sosmap .tf { z-index: 500; }
.mk-tech { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 800 12px var(--font);
  border: 3px solid #fff; box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent); }
.mk-home { width: 22px; height: 22px; border-radius: 50%; background: #FF3B30; border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(255, 59, 48, .18); }

/* desktop: the taskbar becomes a slim pill; pages breathe */
@media (min-width: 900px) {
  #view.scr { padding-left: 32px; padding-right: 32px; }
  .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
}
.grid-2 > * { min-width: 0; }

/* 3D view, in a page */
.iso.glass { border-radius: 30px; padding: 10px; }
.iso.iso-page > svg { min-height: 320px; }

/* Inter before the system font: one look on every phone (SF on Apple devices is close; Android and Windows differ). */
body.mx { --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif; font-family: var(--font); }
.lt h3 { font-size: clamp(28px, 7.4vw, 34px); }
.lt { align-items: center; }

/* Budget rings: the list sits beside the rings when there is room, under them on a phone. */
.ringwrap { flex-wrap: wrap; justify-content: center; }
.ringwrap .rlist { flex: 1 1 230px; }
.rlist > div { grid-template-columns: 1fr auto 46px; }
.rlist b { font-size: 17px; white-space: nowrap; }
.rlist .k { white-space: nowrap; }
/* Room for the floating taskbar under the last thing on a page. */
#view.scr > .page::after { content: ""; display: block; height: 24px; flex: 0 0 auto; }
