/* GroupDesk motion system — Corporate personality.
   Signature easing: cubic-bezier(.2,0,0,1) · durations: 140 / 260 / 420ms · entrance: rise 12px + fade.
   Page entrances are gated by html[data-m] (set by motion.js on navigation only), so re-renders never replay them. */
:root {
  --m-ease: cubic-bezier(.2, 0, 0, 1);
  --m-out: cubic-bezier(.05, .7, .1, 1);
  --m-in: cubic-bezier(.3, 0, 1, 1);
  --m-back: cubic-bezier(.175, .885, .32, 1.275);
  --m-quick: 140ms; --m-std: 260ms; --m-slow: 420ms;
}
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }

@keyframes m-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes m-rise-sm { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes m-drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes m-slide-r { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes m-card-in { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes m-modal { from { opacity: 0; transform: translateY(14px) scale(.965); } to { opacity: 1; transform: none; } }
@keyframes m-grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes m-grow-y { from { transform: scaleY(0); } to { transform: none; } }
@keyframes m-ring { from { --p: 0; } }
@keyframes m-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-4px); } 88% { transform: translateX(2px); } }
@keyframes m-toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes m-toast-shake { 0%, 100% { transform: translate(-50%, 0); } 25% { transform: translate(calc(-50% - 7px), 0); } 55% { transform: translate(calc(-50% + 6px), 0); } 80% { transform: translate(calc(-50% - 3px), 0); } }
@keyframes m-toast-out { to { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes m-halo { from { box-shadow: 0 0 0 0 rgba(21, 115, 71, .35); } to { box-shadow: 0 0 0 18px rgba(21, 115, 71, 0); } }
@keyframes m-breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes m-drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6%, 5%) scale(1.12); } }
@keyframes m-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes m-load { 0% { transform: translateX(-100%) scaleX(.4); } 50% { transform: translateX(20%) scaleX(.7); } 100% { transform: translateX(110%) scaleX(.4); } }
@keyframes m-nav-on { from { background: var(--brand-2); color: var(--ink); } }

/* ---------- interactive feedback (always on) ---------- */
.btn { transition: background-color var(--m-quick) var(--m-ease), border-color var(--m-quick) var(--m-ease), color var(--m-quick) var(--m-ease), box-shadow var(--m-std) var(--m-ease), transform var(--m-quick) var(--m-ease); }
.btn.primary:hover, .btn.wa:hover { box-shadow: 0 4px 12px rgba(15, 94, 75, .22); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(.97); box-shadow: none; transition-duration: 60ms; }
.icon-btn, .link { transition: color var(--m-quick) var(--m-ease), transform var(--m-quick) var(--m-ease); }
.icon-btn:hover { color: var(--ink); }
.icon-btn[data-close]:hover { transform: rotate(90deg); }
.icon-btn:active { transform: scale(.88); }
.icon-btn[data-close]:active { transform: rotate(90deg) scale(.88); }
input, select, textarea { transition: border-color var(--m-quick) var(--m-ease), box-shadow var(--m-std) var(--m-ease), background-color var(--m-std) var(--m-ease); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px rgba(15, 94, 75, .08); }
.sidenav a { transition: background-color var(--m-quick) var(--m-ease), color var(--m-quick) var(--m-ease); }
.sidenav a span { transition: transform var(--m-std) var(--m-back); }
.sidenav a:hover span { transform: scale(1.15); }
.sidenav a:active span { transform: scale(.92); }
.set-tabs a, .checklist a, .cycle-opt { transition: background-color var(--m-quick) var(--m-ease), border-color var(--m-quick) var(--m-ease), color var(--m-quick) var(--m-ease), transform var(--m-quick) var(--m-ease); }
.set-tabs a:active, .cycle-opt:active { transform: scale(.97); }
.checklist a:hover { transform: translateX(3px); }
.checklist .go, .set-open { display: inline-block; transition: transform var(--m-std) var(--m-ease); }
.checklist a:hover .go, .set-tile:hover .set-open { transform: translateX(4px); }
.set-tile { transition: border-color var(--m-quick) var(--m-ease), transform var(--m-std) var(--m-ease), box-shadow var(--m-std) var(--m-ease); }
.set-tile:hover { box-shadow: 0 2px 4px rgba(0, 0, 0, .04), 0 10px 24px rgba(15, 94, 75, .10); }
.set-ico { transition: transform var(--m-std) var(--m-back); }
.set-tile:hover .set-ico { transform: scale(1.08) rotate(-4deg); }
.cat-card, .bearer { transition: border-color var(--m-quick) var(--m-ease), transform var(--m-std) var(--m-ease), box-shadow var(--m-std) var(--m-ease); }
.cat-card:hover, .bearer:hover { border-color: #cfd8d3; transform: translateY(-2px); box-shadow: var(--shadow); }
.tbl tbody tr { transition: background-color var(--m-quick) var(--m-ease); }
.tbl tbody tr:hover { background: #fbfaf7; }
.tbl.fb tbody tr.sec:hover, .tbl tr.total:hover { background: none; }
.progress .bar span { transition: width var(--m-slow) var(--m-ease); }
.pill, .cycle-opt, .tick { transition: background-color var(--m-std) var(--m-ease), color var(--m-std) var(--m-ease), border-color var(--m-std) var(--m-ease); }
.btn.wa.done { animation: m-rise-sm var(--m-std) var(--m-out); }

/* ---------- loading ---------- */
.boot { animation: m-breathe 1.4s ease-in-out infinite; }
.content { transition: opacity 200ms var(--m-ease); }
#app.loading::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; transform-origin: left;
  background: linear-gradient(90deg, var(--brand), var(--accent)); animation: m-load 1.1s linear infinite; }

/* ---------- overlays: modal, toast ---------- */
.modal-wrap { animation: m-fade 200ms var(--m-ease) both; }
.modal-wrap > .modal { animation: m-modal 340ms var(--m-out) both; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.modal-wrap .modal-body > * { animation: m-fade 240ms 120ms var(--m-ease) both; }
.toast { animation: m-toast-in 280ms var(--m-out) both, m-toast-out 260ms 3.2s var(--m-in) forwards; }
.toast.err { animation: m-toast-in 280ms var(--m-out) both, m-toast-shake 340ms 280ms ease-in-out, m-toast-out 260ms 3.2s var(--m-in) forwards; }

/* ---------- state feedback ---------- */
.field.invalid { animation: m-shake 340ms ease-in-out; }
.big-tick { animation: m-pop 380ms var(--m-back) both, m-halo 700ms 200ms var(--m-ease) both; }
.big-tick ~ * { animation: m-rise-sm var(--m-std) 220ms var(--m-out) both; }

/* ---------- ambient: auth + public join backgrounds ---------- */
.auth, .join { position: relative; overflow: hidden; }
.auth::before, .join::before { content: ''; position: absolute; width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(15, 94, 75, .10), transparent 62%); animation: m-drift 18s ease-in-out infinite; }
.auth::after, .join::after { content: ''; position: absolute; width: 46vmax; height: 46vmax; right: -16vmax; bottom: -20vmax; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(246, 196, 83, .16), transparent 62%); animation: m-drift 24s ease-in-out infinite reverse; }
.auth > *, .join > * { position: relative; z-index: 1; }
.auth .brand-mark { animation: m-float 5s ease-in-out infinite; }

/* ---------- page entrances (navigation only) ---------- */
html[data-m] .content > * { animation: m-rise var(--m-slow) var(--m-out) both; }
html[data-m] .content > :nth-child(1) { animation-name: m-slide-r; animation-duration: var(--m-std); }
html[data-m] .content > :nth-child(2) { animation-delay: 50ms; }
html[data-m] .content > :nth-child(3) { animation-delay: 100ms; }
html[data-m] .content > :nth-child(4) { animation-delay: 150ms; }
html[data-m] .content > :nth-child(5) { animation-delay: 200ms; }
html[data-m] .content > :nth-child(n+6) { animation-delay: 250ms; }
/* grids hand the entrance to their children as a micro cascade */
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) { animation: none; }
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) > * { animation: m-rise var(--m-slow) var(--m-out) both; animation-delay: 60ms; }
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) > :nth-child(2) { animation-delay: 100ms; }
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) > :nth-child(3) { animation-delay: 140ms; }
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) > :nth-child(4) { animation-delay: 180ms; }
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) > :nth-child(5) { animation-delay: 220ms; }
html[data-m] .content > :is(.kpis, .set-tiles, .grid2.gap) > :nth-child(n+6) { animation-delay: 260ms; }
html[data-m] :is(.board, .cat-grid, .checklist, .role-grid, .hint-row) > * { animation: m-rise-sm var(--m-std) var(--m-out) both; animation-delay: 180ms; }
html[data-m] :is(.board, .cat-grid, .checklist, .role-grid, .hint-row) > :nth-child(2) { animation-delay: 210ms; }
html[data-m] :is(.board, .cat-grid, .checklist, .role-grid, .hint-row) > :nth-child(3) { animation-delay: 240ms; }
html[data-m] :is(.board, .cat-grid, .checklist, .role-grid, .hint-row) > :nth-child(4) { animation-delay: 270ms; }
html[data-m] :is(.board, .cat-grid, .checklist, .role-grid, .hint-row) > :nth-child(5) { animation-delay: 300ms; }
html[data-m] :is(.board, .cat-grid, .checklist, .role-grid, .hint-row) > :nth-child(n+6) { animation-delay: 330ms; }
/* table rows: first dozen cascade, the rest are simply there */
html[data-m] .content .tbl tbody tr:nth-child(-n+12) { animation: m-rise-sm var(--m-std) var(--m-out) both; }
html[data-m] .content .tbl tbody tr:nth-child(1) { animation-delay: 140ms; } html[data-m] .content .tbl tbody tr:nth-child(2) { animation-delay: 162ms; }
html[data-m] .content .tbl tbody tr:nth-child(3) { animation-delay: 184ms; } html[data-m] .content .tbl tbody tr:nth-child(4) { animation-delay: 206ms; }
html[data-m] .content .tbl tbody tr:nth-child(5) { animation-delay: 228ms; } html[data-m] .content .tbl tbody tr:nth-child(6) { animation-delay: 250ms; }
html[data-m] .content .tbl tbody tr:nth-child(7) { animation-delay: 272ms; } html[data-m] .content .tbl tbody tr:nth-child(8) { animation-delay: 294ms; }
html[data-m] .content .tbl tbody tr:nth-child(9) { animation-delay: 316ms; } html[data-m] .content .tbl tbody tr:nth-child(10) { animation-delay: 338ms; }
html[data-m] .content .tbl tbody tr:nth-child(11) { animation-delay: 360ms; } html[data-m] .content .tbl tbody tr:nth-child(12) { animation-delay: 382ms; }
/* data: bars grow, ring fills */
html[data-m] .progress .bar span { transform-origin: left; animation: m-grow-x 700ms 220ms var(--m-out) both; }
html[data-m] .chart .bars span { transform-origin: bottom; animation: m-grow-y 520ms var(--m-out) both; animation-delay: 200ms; }
html[data-m] .chart .col:nth-child(2) .bars span { animation-delay: 225ms; } html[data-m] .chart .col:nth-child(3) .bars span { animation-delay: 250ms; }
html[data-m] .chart .col:nth-child(4) .bars span { animation-delay: 275ms; } html[data-m] .chart .col:nth-child(5) .bars span { animation-delay: 300ms; }
html[data-m] .chart .col:nth-child(6) .bars span { animation-delay: 325ms; } html[data-m] .chart .col:nth-child(7) .bars span { animation-delay: 350ms; }
html[data-m] .chart .col:nth-child(8) .bars span { animation-delay: 375ms; } html[data-m] .chart .col:nth-child(9) .bars span { animation-delay: 400ms; }
html[data-m] .chart .col:nth-child(10) .bars span { animation-delay: 425ms; } html[data-m] .chart .col:nth-child(11) .bars span { animation-delay: 450ms; }
html[data-m] .chart .col:nth-child(12) .bars span { animation-delay: 475ms; }
html[data-m] .ring { animation: m-ring 900ms 200ms var(--m-out) both; }
html[data-m] .checklist li.ok .tick { animation: m-pop var(--m-std) 380ms var(--m-back) both; }
/* hero pieces */
html[data-m] .receipt { animation: m-card-in 480ms var(--m-out) both; }
html[data-m] .mcard { animation: m-card-in 520ms 80ms var(--m-out) both; }
html[data-m] .sidenav a.active { animation: m-nav-on var(--m-std) var(--m-ease); }
/* auth, onboarding, public join */
html[data-m] .auth-card, html[data-m] .join-card { animation: m-card-in 520ms var(--m-out) both; }
html[data-m] .auth-card .brand-mark, html[data-m] .join-head .brand-mark, html[data-m] .join-logo { animation: m-pop 420ms 160ms var(--m-back) both; }
html[data-m] .auth-card .field, html[data-m] .auth-card .btn.block, html[data-m] .auth-links { animation: m-rise-sm var(--m-std) var(--m-out) both; animation-delay: 200ms; }
html[data-m] .auth-card .field:nth-of-type(2) { animation-delay: 240ms; } html[data-m] .auth-card .field:nth-of-type(3) { animation-delay: 280ms; }
html[data-m] .auth-card .btn.block { animation-delay: 320ms; } html[data-m] .auth-links { animation-delay: 360ms; }
html[data-m] .join fieldset { animation: m-rise var(--m-slow) var(--m-out) both; animation-delay: 160ms; }
html[data-m] .join fieldset:nth-of-type(2) { animation-delay: 220ms; } html[data-m] .join fieldset:nth-of-type(n+3) { animation-delay: 280ms; }
/* first paint only: the app chrome arrives before the page */
html[data-m="first"] .topbar { animation: m-drop var(--m-slow) var(--m-out) both; }
html[data-m="first"] .sidenav a { animation: m-slide-r var(--m-std) var(--m-out) both; animation-delay: 80ms; }
html[data-m="first"] .sidenav a:nth-child(2) { animation-delay: 105ms; } html[data-m="first"] .sidenav a:nth-child(3) { animation-delay: 130ms; }
html[data-m="first"] .sidenav a:nth-child(4) { animation-delay: 155ms; } html[data-m="first"] .sidenav a:nth-child(5) { animation-delay: 180ms; }
html[data-m="first"] .sidenav a:nth-child(6) { animation-delay: 205ms; } html[data-m="first"] .sidenav a:nth-child(7) { animation-delay: 230ms; }
html[data-m="first"] .sidenav a:nth-child(n+8) { animation-delay: 255ms; }
html[data-m="first"] .banner { animation: m-fade var(--m-slow) var(--m-ease) both; }

/* ---------- never in print, never against the user's motion setting ---------- */
@media print { *, *::before, *::after { animation: none !important; transition: none !important; } .auth::before, .auth::after, .join::before, .join::after, #app.loading::before { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .btn.primary:hover, .btn.wa:hover, .set-tile:hover, .cat-card:hover, .bearer:hover, .checklist a:hover { transform: none; }
}
