/* ===== Icons that move + the installed phone app (owner 2026-11-16 "OK Lucide, OK ফোন"; docs/03 §39) =====
   Icons are Lucide's drawings (index.html #i-*). Each animation tells what a button does, once, when it's hovered
   (computer) or pressed (phone), or when its moment comes (a new notification, a tapped tab). Nothing moves for people
   who ask their phone for less motion. Phones (≤760px): a docked tab bar with icons only and a sliding circle under
   the chosen tab, big titles that hand over to the top bar, menus and dialogs as bottom sheets, pull to refresh,
   toasts above the tab bar, bigger touch areas. Placed last: it overrides 06/10. */

/* ---------- Icons that move (all sizes) ---------- */
@keyframes icRing{0%,100%{transform:rotate(0)}15%{transform:rotate(14deg)}30%{transform:rotate(-12deg)}45%{transform:rotate(9deg)}60%{transform:rotate(-6deg)}75%{transform:rotate(3deg)}}
@keyframes icHop{0%{transform:none}30%{transform:scale(1.14,.86)}60%{transform:scale(.94,1.08) translateY(-3px)}100%{transform:none}}
@keyframes icTurn{from{transform:rotate(-90deg) scale(.7)}to{transform:none}}
@keyframes icSpin{to{transform:rotate(360deg)}}
@keyframes icGear{to{transform:rotate(90deg)}}
@keyframes icLift{0%,100%{transform:none}40%{transform:translateY(-3px)}}
@keyframes icDrop{0%,100%{transform:none}40%{transform:translateY(3px)}}
@keyframes icWiggle{0%,100%{transform:none}25%{transform:rotate(-12deg)}55%{transform:rotate(9deg)}80%{transform:rotate(-4deg)}}
@keyframes icDrive{0%{transform:translateX(-7px);opacity:.25}60%{transform:translateX(2px);opacity:1}100%{transform:none}}
@keyframes icBuzz{0%,100%{transform:none}12%,36%,60%{transform:rotate(-11deg)}24%,48%,72%{transform:rotate(11deg)}}
@keyframes icPop{0%{transform:none}40%{transform:scale(1.2)}100%{transform:none}}
@keyframes icDraw{from{stroke-dashoffset:32}to{stroke-dashoffset:0}}
@keyframes icTwinkle{0%,100%{transform:none}50%{transform:scale(1.18) rotate(12deg)}}
@keyframes icFloat{0%,100%{transform:none}50%{transform:translateY(-4px)}}

@media (prefers-reduced-motion:no-preference){
  /* Moments, started by js/core/phone-app.js */
  svg.i.ic-ring{animation:icRing .9s var(--ease);transform-origin:50% 12%}
  svg.i.ic-hop{animation:icHop .5s var(--ease);transform-origin:50% 100%}
  svg.i.ic-turn{animation:icTurn .45s var(--ease)}
  /* Hover (computer) or press (phone): the icon shows what the button does */
  :is(.btn,.icon-btn,.nav-item,.chip,.mtab button,.menu button):is(:hover,:active) svg.i:has(use[href="#i-refresh"]){animation:icSpin .7s var(--ease)}
  :is(.btn,.icon-btn,.nav-item,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-settings"]){animation:icGear .5s var(--ease)}
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-upload"]),
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-printer"]){animation:icLift .6s var(--ease)}
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-download"]){animation:icDrop .6s var(--ease)}
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-trash"]),
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-edit"]){animation:icWiggle .6s var(--ease);transform-origin:50% 80%}
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-truck"]){animation:icDrive .7s var(--ease)}
  :is(.btn,.icon-btn,.chip,.call,.call-btn,.menu button):is(:hover,:active) svg.i:has(use[href="#i-phone"]){animation:icBuzz .6s linear}
  :is(.btn,.icon-btn,.nav-item):is(:hover,:active) svg.i:has(use[href="#i-bell"]){animation:icRing .9s var(--ease);transform-origin:50% 12%}
  :is(.btn,.icon-btn,.chip):is(:hover,:active) svg.i:has(use[href="#i-plus"]){animation:icTurn .45s var(--ease)}
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-check"]){stroke-dasharray:32;animation:icDraw .5s var(--ease)}
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-copy"]),
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-scan"]),
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-share"]),
  :is(.btn,.icon-btn,.chip,.menu button):is(:hover,:active) svg.i:has(use[href="#i-whatsapp"]){animation:icPop .45s var(--ease)}
  :is(.btn,.icon-btn,.chip):is(:hover,:active) svg.i:has(use[href="#i-sparkle"]){animation:icTwinkle .6s var(--ease)}
  .nav-item:hover svg.i{animation:icPop .4s var(--ease)}
  .nav-item:hover svg.i:has(use[href="#i-settings"]){animation:icGear .5s var(--ease)}
  /* Empty and "comes next" pages: the icon breathes a little */
  .placeholder .ic svg.i{animation:icFloat 2.6s var(--ease) 2}
}

/* ---------- Tips that can be closed (all sizes) ---------- */
.note-bar.tip{background:color-mix(in srgb,var(--brand-peach) 14%,var(--bg-sidebar));border:1px solid var(--border);color:var(--text-secondary)}
[data-theme="dark"] .note-bar.tip{background:var(--bg-card);border-color:var(--border)}
.note-bar.tip>svg.i{color:var(--brand-orange-ui)}
.tip-x{margin-left:auto;flex:none;width:28px;height:28px;border-radius:999px;display:grid;place-items:center;color:var(--text-muted)}
.tip-x:hover{background:var(--bg-chip);color:var(--text-primary)}

/* ---------- The installed phone app ---------- */
.mt-title,.mt-pill,.sheet-scrim,.ptr{display:none}
@keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}
@keyframes toastUp{from{transform:translateY(16px);opacity:0}to{transform:none;opacity:1}}
@keyframes pageIn{from{opacity:0;transform:translateX(14px)}to{opacity:1;transform:none}}

@media (max-width:760px){
  .main{padding-bottom:calc(84px + env(safe-area-inset-bottom))}

  /* The tab bar (owner 2026-11-16: "Just improve the bottom nav without bottom title"): icons only, docked at the
     bottom with rounded top corners, always shown. The chosen tab's icon turns orange on a soft orange circle that
     slides from tab to tab; the others are muted. New is the solid orange circle. The tab names stay for screen
     readers (and as the buttons' names), but are not shown. */
  .mtab{left:0;right:0;bottom:0;height:calc(64px + env(safe-area-inset-bottom));border-radius:24px 24px 0 0;padding:0 8px env(safe-area-inset-bottom);
    background:var(--bg-sidebar);border:0;box-shadow:0 -1px 0 var(--border),0 -12px 30px -16px rgba(19,6,0,.3)}
  [data-theme="dark"] .mtab{background:var(--bg-card);box-shadow:0 -1px 0 var(--border),0 -12px 30px -16px rgba(0,0,0,.85)}
  .mtab button{position:relative;z-index:1;height:64px;color:var(--text-muted);transition:color var(--t) ease}
  .mtab button>span:not(.circle){position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .mtab button>svg.i{width:24px;height:24px;transition:transform var(--t-fast) var(--ease)}
  .mtab button:active>svg.i{transform:scale(.88)}
  .mtab button.on{color:var(--brand-orange-ui)}
  .mtab button.on svg.i{stroke-width:2.25}
  .mt-pill{display:block;position:absolute;top:9px;width:46px;height:46px;border-radius:999px;pointer-events:none;
    background:color-mix(in srgb,var(--brand-orange-ui) 14%,transparent);transition:left var(--t-slow) var(--ease),opacity var(--t) ease}
  .mt-pill.off{opacity:0}
  .mtab .mt-new .circle{width:48px;height:48px;border-radius:999px;box-shadow:0 8px 18px -8px rgba(240,84,9,.8);transition:transform var(--t-fast) var(--ease)}
  .mtab .mt-new .circle svg.i{width:24px;height:24px;stroke-width:2.4}
  .mtab .mt-new:active .circle{transform:scale(.9)}
  .bulkbar{bottom:calc(76px + env(safe-area-inset-bottom))}

  /* Big titles; once one scrolls away, the top bar shows it */
  .display{font-size:28px;line-height:34px;letter-spacing:-.02em}
  .no-page .display{font-size:20px;line-height:26px;letter-spacing:0}
  /* A header with three buttons or more puts them on their own row under the title (they never run off the screen) */
  .page-head:has(.actions>:nth-child(3)){flex-wrap:wrap}
  .page-head:has(.actions>:nth-child(3)) .actions{width:100%;margin-left:0;justify-content:flex-start;overflow-x:auto;scrollbar-width:none}
  .page-head:has(.actions>:nth-child(3)) .actions::-webkit-scrollbar{display:none}
  .topbar{position:relative;transition:box-shadow var(--t) ease}
  body.scrolled .topbar{box-shadow:0 1px 0 var(--border),0 10px 20px -16px rgba(19,6,0,.35)}
  .mt-title{display:block;position:absolute;left:50%;top:50%;transform:translate(-50%,-30%);opacity:0;pointer-events:none;
    max-width:50%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;font-size:16px;color:var(--text-primary);
    transition:opacity var(--t) ease,transform var(--t) var(--ease)}
  body.title-up .mt-title{opacity:1;transform:translate(-50%,-50%)}
  .store-switch{transition:opacity var(--t) ease}
  body.title-up .store-switch{opacity:0;pointer-events:none}

  /* Menus and dialogs come up from the bottom, in thumb's reach; a swipe down closes them */
  .menu{top:auto!important;left:0!important;right:0;bottom:0;width:auto!important;min-width:0!important;max-height:min(72vh,560px)!important;
    border-radius:24px 24px 0 0;padding:22px 8px calc(10px + env(safe-area-inset-bottom));box-shadow:0 -12px 40px rgba(19,6,0,.25);z-index:62;
    animation:sheetUp var(--t-slow) var(--ease)!important;touch-action:pan-y}
  .menu::before,.modal::before{content:"";position:absolute;top:8px;left:50%;width:40px;height:4px;margin-left:-20px;border-radius:9px;background:color-mix(in srgb,var(--text-muted) 55%,transparent)}
  .menu button{min-height:46px;font-size:15px;padding:10px 12px}
  .menu .dd-s{margin:0 4px 6px}
  .sheet-scrim{display:block;position:fixed;inset:0;z-index:61;background:rgba(19,6,0,.38);animation:fadeIn var(--t) ease}
  .modal-wrap{place-items:end stretch;padding:0}
  .modal{position:relative;width:100%;max-height:92vh;max-height:92dvh;border-radius:24px 24px 0 0;padding-bottom:env(safe-area-inset-bottom)}
  .modal-wrap.show .modal{animation:sheetUp var(--t-slow) var(--ease)}
  .modal header{padding-top:26px}
  .menu.dragging,.modal.dragging{transition:none;animation:none!important}

  /* Toasts sit above the tab bar */
  .toasts{top:auto;bottom:calc(76px + env(safe-area-inset-bottom));left:12px;right:12px}
  .toast{width:auto;max-width:none;animation:toastUp var(--t-slow) var(--ease)}

  /* Bigger touch areas without moving anything; pressing gives way a little */
  .icon-btn,.btn.xs,.btn.sm{position:relative}
  .icon-btn::after,.btn.xs::after,.btn.sm::after{content:"";position:absolute;inset:-6px}
  .m-card,.kpi,.pd-card,.cu-card{transition:transform var(--t-fast) var(--ease)}
  .m-card:active,.kpi:active,.pd-card:active,.cu-card:active{transform:scale(.98)}

  /* A page slides in when it opens */
  .page-in{animation:pageIn .28s var(--ease)}

  /* Pull to refresh */
  .ptr{display:grid;place-items:center;position:fixed;left:50%;top:calc(60px + env(safe-area-inset-top));z-index:15;width:38px;height:38px;margin-left:-19px;
    border-radius:999px;background:var(--bg-sidebar);color:var(--brand-orange-ui);box-shadow:0 6px 18px rgba(19,6,0,.18);pointer-events:none;opacity:0;
    transform:translateY(calc(var(--p,0) * 1px - 46px)) rotate(calc(var(--p,0) * 3deg))}
  .ptr:not(.on){transition:transform var(--t) var(--ease),opacity var(--t) ease}
  .ptr.on{opacity:1}
  .ptr.ready{background:var(--brand-orange-ui);color:#fff}
  .ptr.spin svg.i{animation:icSpin .7s linear infinite}
}
@media (max-width:760px) and (prefers-reduced-motion:reduce){
  .mtab button,.mtab button>svg.i,.mt-pill,.mt-title,.store-switch,.ptr{transition:none}
  .menu,.modal-wrap.show .modal,.toast,.page-in{animation:none!important}
}
