/* motion.css (Builder 3; colours are theme tokens since Builder 6, see app.css): screen transitions, sheets, toasts, lists, press feedback, focus, phone niceties.
   Loaded after app.css. Moving things (pages, sheets, toasts, lists, the opening light-up) are driven by
   js/motion.js with the Web Animations API on transform/opacity only; this file holds the tokens, the View
   Transition pseudo-elements, CSS transitions (press, hover, pills) and loaders.
   Modes (motion.js sets one on <html>): mo-on (default, like the live CC "Always on"), mo-auto (follows the
   device), mo-off. html.mo-reduced = effective reduced motion (mo-off, or mo-auto + device asks for less). */

:root{
  --mo-out:cubic-bezier(.23,1,.32,1);          /* entering, responding */
  --mo-inout:cubic-bezier(.77,0,.175,1);       /* moving on screen */
  --mo-drawer:cubic-bezier(.32,.72,0,1);       /* iOS sheet curve */
  --mo-press:140ms;
}

/* ───────── page changes (View Transitions API; motion.js names the parts only while a change runs) ─────────
   The page itself moves as the root picture (always the size of the screen, cheap on phones). The sidebar, the phone
   top bar and tab bar, toasts and open sheets are their own pictures, so they stay put above it. */
.mo-vt-run .side{view-transition-name:mo-side}
.mo-vt-run .topbar{view-transition-name:mo-top}
.mo-vt-run .tabbar{view-transition-name:mo-tabbar}
.mo-vt-run .toasts{view-transition-name:mo-toasts}
/* taps during the change reach the new page underneath */
:root::view-transition{pointer-events:none}
:root::view-transition-group(root){animation:none}
:root::view-transition-old(root),:root::view-transition-new(root){mix-blend-mode:plus-lighter}
/* parts that animate live (tab pills, toasts, exiting sheets) show only their live picture */
:root::view-transition-old(mo-tabbar),:root::view-transition-old(mo-toasts),:root::view-transition-old(mo-tabs),:root::view-transition-old(mo-side){animation:none;opacity:0}
:root::view-transition-new(mo-tabbar),:root::view-transition-new(mo-toasts),:root::view-transition-new(mo-tabs),:root::view-transition-new(mo-side){animation:none}
:root::view-transition-group(mo-tabbar),:root::view-transition-group(mo-toasts),:root::view-transition-group(mo-top),:root::view-transition-group(mo-side){animation:none}
:root::view-transition-old(*.mo-live){animation:none;opacity:0}
:root::view-transition-new(*.mo-live){animation:none}
:root::view-transition-group(*.mo-live){animation:none}
/* deeper = from the right, back = from the left, tabs of the same record = small slide by tab order, sections = rise */
html[data-mo-dir=fwd]::view-transition-old(root){animation:mo-out-l 150ms var(--mo-out) both}
html[data-mo-dir=fwd]::view-transition-new(root){animation:mo-in-r 220ms var(--mo-out) both}
html[data-mo-dir=back]::view-transition-old(root){animation:mo-out-r 150ms var(--mo-out) both}
html[data-mo-dir=back]::view-transition-new(root){animation:mo-in-l 220ms var(--mo-out) both}
html[data-mo-dir=latf]::view-transition-old(root){animation:mo-out-l-s 150ms var(--mo-out) both}
html[data-mo-dir=latf]::view-transition-new(root){animation:mo-in-r-s 200ms var(--mo-out) both}
html[data-mo-dir=latb]::view-transition-old(root){animation:mo-out-r-s 150ms var(--mo-out) both}
html[data-mo-dir=latb]::view-transition-new(root){animation:mo-in-l-s 200ms var(--mo-out) both}
html[data-mo-dir=swap]::view-transition-old(root){animation:mo-fade-out 140ms var(--mo-out) both}
html[data-mo-dir=swap]::view-transition-new(root){animation:mo-in-up 200ms var(--mo-out) both}
html.mo-reduced[data-mo-dir]::view-transition-old(root){animation:mo-fade-out 120ms ease both}
html.mo-reduced[data-mo-dir]::view-transition-new(root){animation:mo-fade-in 160ms ease both}
/* shared elements: a list row's photo / name morph into the customer card header */
:root::view-transition-group(mo-photo),:root::view-transition-group(mo-name){animation-duration:240ms;animation-timing-function:var(--mo-out)}
:root::view-transition-old(mo-name),:root::view-transition-new(mo-name){animation-duration:240ms}
:root::view-transition-old(mo-photo),:root::view-transition-new(mo-photo){animation-duration:240ms}
@keyframes mo-out-l{to{opacity:0;transform:translateX(-18px)}}
@keyframes mo-out-r{to{opacity:0;transform:translateX(18px)}}
@keyframes mo-in-r{from{opacity:0;transform:translateX(30px)}}
@keyframes mo-in-l{from{opacity:0;transform:translateX(-30px)}}
@keyframes mo-out-l-s{to{opacity:0;transform:translateX(-10px)}}
@keyframes mo-out-r-s{to{opacity:0;transform:translateX(10px)}}
@keyframes mo-in-r-s{from{opacity:0;transform:translateX(16px)}}
@keyframes mo-in-l-s{from{opacity:0;transform:translateX(-16px)}}
@keyframes mo-in-up{from{opacity:0;transform:translateY(8px)}}
@keyframes mo-fade-in{from{opacity:0}}
@keyframes mo-fade-out{to{opacity:0}}

/* ───────── overlays: motion.js plays enter/exit with WAAPI, so the app.css keyframes are switched off ───────── */
.scrim,.sheet,.toast,.savebar{animation:none}
@media (max-width:899px){.sheet,.sheet.viewer-s{animation:none}}
.scrim{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.sheet,.viewer-b,.search-res,.side-scroll,.menu-s{overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.tabs,.b2-scroll,.b2-chips{-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
.scrim.mo-leaving,.toast.mo-leaving{pointer-events:none}
@media (max-width:899px){
  .sheet:not(.viewer-s){touch-action:pan-y}
  /* the grab handle is the obvious place to pull down */
  .sheet:not(.viewer-s):before{transition:background-color .2s ease}
  .sheet.mo-dragging:before{background:var(--faint)}
  .sheet.mo-dragging{overflow:hidden}
}
/* the opening light-up: a warm light grows out of the logo and washes over the first screen.
   html.mo-first is set by the inline script in index.html before the first paint (pure CSS, compositor only);
   #mo-veil is the same light made by motion.js when that flag is missing. */
@keyframes mo-light{0%{transform:scale(1);opacity:1}60%{transform:scale(22);opacity:1}100%{transform:scale(38);opacity:0}}
html.mo-first body::after{content:'';position:fixed;z-index:100;left:50%;top:50%;width:160vmax;height:160vmax;margin:-80vmax 0 0 -80vmax;border-radius:50%;pointer-events:none;
  background:radial-gradient(circle closest-side,transparent 0,transparent 2vmax,var(--veil-glow) 2.8vmax,var(--veil-glow-2) 3.6vmax,var(--veil) 6.4vmax,var(--veil) 100%);
  will-change:transform,opacity;animation:mo-light 900ms cubic-bezier(.45,0,.2,1) 120ms both}
html.mo-first.mo-first-calm body::after{background:var(--veil);animation:mo-fade-out 300ms ease 60ms both}
#mo-veil{position:fixed;z-index:100;border-radius:50%;pointer-events:none;will-change:transform,opacity}
#mo-veil-floor{position:fixed;z-index:99;inset:0;background:var(--veil);pointer-events:none}
#mo-ghosts{position:fixed;inset:0;z-index:85;pointer-events:none}
#mo-ghosts>*{position:fixed;margin:0;pointer-events:none}

/* ───────── press feedback (quick scale), hover glow (computer), focus rings (keyboard) ───────── */
.btn,.chip,.mini,.pill,.stp,.ctab,.tab,.nav,.mi,.vb,.iconb,.vclose,.tundo,.seg button,.grp,.sr,.ph-link,.dthumb,.vnav,
a.row,button.row,[data-motion=row],.b2-row[role=button],a.card,button.card{
  -webkit-tap-highlight-color:transparent;touch-action:manipulation}
.btn,.chip,.mini,.pill,.stp,.ctab,.nav,.mi,.vb,.iconb,.vclose,.tundo,.seg button,.grp,.sr,.ph-link,.vnav{
  transition:transform var(--mo-press) var(--mo-out),background-color .18s ease,color .18s ease,border-color .18s ease,box-shadow .2s ease,opacity .18s ease}
.btn:active,.chip:active,.mini:active,.pill:active,.stp:active,.ctab:active,.nav:active,.mi:active,.vb:active,
.iconb:active,.vclose:active,.tundo:active,.seg button:active,.grp:active,.sr:active,.ph-link:active{transform:scale(.97)}
.vnav{transform:translateY(-50%)}.vnav:active{transform:translateY(-50%) scale(.94)}
.btn:disabled,.mini:disabled,.chip:disabled{transform:none}
/* big pressables scale less so they do not look like they jump */
a.row,button.row,[data-motion=row],.dthumb,a.card,button.card,.b2-row[role=button]{transition:transform 160ms var(--mo-out),background-color .18s ease,box-shadow .2s ease}
a.row:active,button.row:active,[data-motion=row]:active,a.card:active,button.card:active,.b2-row[role=button]:active{transform:scale(.985)}
.dthumb:active{transform:scale(.97)}
/* the phone tab bar: the icon gives the press, the bar itself never moves */
.tab .ic{transition:transform var(--mo-press) var(--mo-out)}
.tab:active .ic{transform:scale(.86)}
.tabbar{transform:translateZ(0);contain:layout style}
.tab{transition:color .2s ease}
@media (hover:hover) and (pointer:fine){
  .btn:not(.ghost):not(.white):not(.glass):not(.danger):not(.inv):hover{box-shadow:var(--btn-glow)}
  [data-motion=card],.b2-card{transition:border-color .25s ease,box-shadow .3s ease}
  [data-motion=card]:hover,.b2-card:hover{border-color:var(--line-h);box-shadow:var(--hi),var(--shadow-2)}
  a.row:hover,button.row:hover,[data-motion=row]:hover{background-color:var(--glass-hover)}
  a.row .ptile img,.ph-link .ib,[data-motion=photo] img{transition:transform .35s var(--mo-out)}
  a.row:hover .ptile img,[data-motion=photo]:hover img{transform:scale(1.04)}
  .dthumb .dthumb-p{transition:box-shadow .25s ease,transform .25s var(--mo-out)}
  .dthumb:hover .dthumb-p{transform:translateY(-2px)}
  .hero{transition:box-shadow .3s ease}
  .hero:hover{box-shadow:var(--hero-shadow-h)}
}
/* keyboard focus: a clear warm ring, no animation (keyboard actions never animate) */
:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.btn:focus-visible,.chip:focus-visible,.ctab:focus-visible,.tab:focus-visible,.nav:focus-visible,.mi:focus-visible,.vb:focus-visible,
a.row:focus-visible,.dthumb:focus-visible,.seg button:focus-visible,.iconb:focus-visible,.vclose:focus-visible,.tundo:focus-visible{
  outline:2px solid var(--focus);outline-offset:2px;box-shadow:0 0 0 6px var(--focus-glow)}
.in:focus-visible{outline:2px solid var(--focus);outline-offset:0;box-shadow:0 0 0 5px var(--focus-glow)}
:focus:not(:focus-visible){outline:none}

/* ───────── gliding pills: card tabs, segmented controls, the phone tab bar, the sidebar ───────── */
.mo-pill{isolation:isolate}
.tabs.mo-pill,.seg.mo-pill,.side-scroll.mo-pill{position:relative}
.mo-pill::before{content:'';position:absolute;left:0;top:0;z-index:-1;pointer-events:none;border-radius:12px;background:var(--sel);
  width:var(--mo-pw,0px);height:var(--mo-ph,0px);transform:translate3d(var(--mo-px,0px),var(--mo-py,0px),0);opacity:1;
  transition:transform 320ms var(--mo-out),width 320ms var(--mo-out),height 320ms var(--mo-out),opacity .2s ease}
.mo-pill.mo-pill-instant::before{transition:none}
.mo-pill:not(.mo-pill-has)::before{opacity:0}
.tabs.mo-pill.mo-pill-has .ctab.on{background:transparent}
.tabs.mo-pill .ctab{transition:transform var(--mo-press) var(--mo-out),background-color .18s ease,color .16s ease}
.tabs.mo-pill .ctab.on{transition-delay:0s,0s,70ms}
.tabs.mo-pill-arriving .ctab.on{color:var(--text);transition-delay:0s}
.seg.mo-pill::before{border-radius:9px}
.seg.mo-pill.mo-pill-has button.on{background:transparent}
.seg.mo-pill button{position:relative;transition:transform var(--mo-press) var(--mo-out),color .16s ease}
.tabbar.mo-pill::before{border-radius:16px;background:var(--accent-bg)}
.tabbar.mo-pill.mo-pill-has .tab.on{background:transparent}
.side-scroll.mo-pill::before{border-radius:12px;background:var(--side-on);box-shadow:var(--side-on-shadow)}
.side-scroll.mo-pill.mo-pill-has .nav.on{background:transparent}
.side-scroll.mo-pill .nav:hover{background:var(--side-hover)}

/* ───────── folding: sidebar groups, details, any [data-motion~=height] ───────── */
.grp .ic{transition:transform 220ms var(--mo-out)!important}
details[data-motion~=height],details.mo-smooth{interpolate-size:allow-keywords}
details[data-motion~=height]::details-content,details.mo-smooth::details-content{block-size:0;overflow:clip;
  transition:block-size 260ms var(--mo-out),content-visibility 260ms allow-discrete}
details[data-motion~=height][open]::details-content,details.mo-smooth[open]::details-content{block-size:auto}

/* ───────── numbers, bars ───────── */
[data-motion=count],.t{font-variant-numeric:tabular-nums}
.bar>i{animation:none;transform-origin:left center}

/* ───────── loading: skeleton shimmer while the very first data loads (no saved copy yet) ───────── */
@keyframes mo-sheen{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
@keyframes mo-breathe{0%,100%{opacity:.35}50%{opacity:1}}
@keyframes mo-spin{to{transform:rotate(360deg)}}
@keyframes mo-pulse{50%{opacity:.4}}
.skel{position:relative;overflow:hidden;background:var(--skel);animation:none}
.skel::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg,transparent,var(--skel-hi),transparent);animation:mo-sheen 1.4s ease-in-out infinite}
main.screen>.loading-screen:has(>.spin),.screen-in>.loading-screen:has(>.spin){position:relative;display:block;min-height:min(72vh,760px);padding:2px 0 0;text-align:left;overflow:hidden;
  color:var(--faint);font-size:12.5px;font-weight:600;letter-spacing:.08em;text-transform:uppercase}
main.screen>.loading-screen>.spin,.screen-in>.loading-screen>.spin{display:none}
main.screen>.loading-screen:has(>.spin)::before,.screen-in>.loading-screen:has(>.spin)::before{content:'';position:absolute;left:0;top:30px;width:min(360px,64%);height:30px;border-radius:10px;
  background:var(--skel);box-shadow:0 46px 0 -4px var(--skel)}
main.screen>.loading-screen:has(>.spin)::after,.screen-in>.loading-screen:has(>.spin)::after{content:'';position:absolute;left:0;right:0;top:132px;height:132px;border-radius:20px;
  background:var(--skel);box-shadow:0 148px 0 0 var(--skel),0 296px 0 0 var(--skel)}
.mo-sheen-layer{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:20px}
.mo-sheen-layer::after{content:'';position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,var(--skel-hi) 50%,transparent 70%);animation:mo-sheen 1.5s ease-in-out infinite}

/* ───────── reduced motion ─────────
   Effective reduced (html.mo-reduced): quick fades, no movement, calm breathing loaders (never a frozen spinner). */
html.mo-reduced .btn:active,html.mo-reduced .chip:active,html.mo-reduced .mini:active,html.mo-reduced .pill:active,html.mo-reduced .ctab:active,
html.mo-reduced .nav:active,html.mo-reduced .mi:active,html.mo-reduced .vb:active,html.mo-reduced .iconb:active,html.mo-reduced .vclose:active,
html.mo-reduced .tundo:active,html.mo-reduced .seg button:active,html.mo-reduced .grp:active,html.mo-reduced .sr:active,html.mo-reduced .ph-link:active,
html.mo-reduced a.row:active,html.mo-reduced [data-motion=row]:active,html.mo-reduced .dthumb:active,html.mo-reduced .tab:active .ic,html.mo-reduced .stp:active{transform:none;opacity:.78}
html.mo-reduced .vnav:active{transform:translateY(-50%);opacity:.78}
html.mo-reduced .mo-pill::before{transition:opacity .15s ease}
html.mo-reduced a.row:hover .ptile img,html.mo-reduced .dthumb:hover .dthumb-p{transform:none}
html.mo-reduced .spin{animation:mo-breathe 1.6s ease-in-out infinite!important;border-top-color:var(--orange)}
html.mo-reduced .skel::after,html.mo-reduced .mo-sheen-layer::after{animation:none!important}
html.mo-reduced .skel{animation:mo-breathe 1.8s ease-in-out infinite!important}
html.mo-reduced .sync .dot{animation-duration:1.6s!important;animation-iteration-count:infinite!important}
html.mo-off *,html.mo-off *::before,html.mo-off *::after{transition-duration:0s!important}

/* app.css scopes its own reduced-motion rule to html:not(.mo-on), so "Always on" keeps every animation here. */
