/* =========================================================
   PAWS & PLAY — app shell shared by client portal & trainer admin
   ========================================================= */
body.app { background: var(--cream); min-height: 100svh; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.shell { display: grid; grid-template-columns: 284px minmax(0, 1fr); min-height: 100svh; }
.side {
  position: sticky; top: 0; height: 100svh; padding: 16px 0 16px 16px; display: flex;
}
.side-in { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; background: var(--paper); border: var(--border); border-radius: var(--r-xl); box-shadow: var(--sh-sm); overflow-y: auto; scrollbar-width: thin; }
.side .brand { padding: 4px 8px 12px; }
.side-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 10px 6px 6px; border-radius: 16px; border: 2px solid transparent;
  text-decoration: none; font-weight: 700; font-size: .95rem; color: var(--ink); transition: background-color .2s, transform .25s var(--ease-spring), box-shadow .2s;
}
.nav-item .ni { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--cream); border: 2px solid transparent; transition: transform .35s var(--ease-spring), background-color .2s; flex: none; }
.nav-item .ni svg { width: 19px; height: 19px; }
.nav-item:hover { background: var(--cream); }
.nav-item:hover .ni { transform: rotate(-8deg) scale(1.06); }
.nav-item:active { transform: scale(.97); }
.nav-item[aria-current="page"] { background: var(--sun); border-color: var(--ink); box-shadow: var(--sh-xs); }
.nav-item[aria-current="page"] .ni { background: var(--paper); border-color: var(--ink); }
.nav-item .count { margin-left: auto; }
.nav-item .soon { margin-left: auto; font-size: 10px; }
.side-foot { margin-top: auto; padding-top: 12px; display: grid; gap: 8px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px; border: var(--border); border-radius: 18px; background: var(--cream); }
.side-user b { display: block; font-size: .95rem; line-height: 1.1; }
.side-user small { color: var(--ink-soft); font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; padding: 16px clamp(16px, 3vw, 36px); background: color-mix(in srgb, var(--cream) 88%, transparent); backdrop-filter: blur(8px); }
.topbar .tb-title { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; display: none; }
.search-trigger { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px 0 16px; border: var(--border); border-radius: var(--r-pill); background: var(--paper); color: var(--ink-soft); font-weight: 600; text-align: left; transition: box-shadow .2s, transform .2s; }
.search-trigger:hover { box-shadow: var(--sh-xs); transform: translate(-1px,-1px); }
.search-trigger svg { width: 18px; height: 18px; color: var(--ink); }
.search-trigger .kbd { margin-left: auto; color: var(--ink); }
.topbar .tb-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.view { flex: 1; padding: 8px clamp(16px, 3vw, 36px) 60px; max-width: 1480px; width: 100%; }

/* page header */
.vhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 8px 0 24px; }
.vhead h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem); margin: 6px 0 0; letter-spacing: -.045em; line-height: .95; }
.vhead .sub { color: var(--ink-soft); margin: 8px 0 0; font-weight: 500; max-width: 60ch; }
.vhead .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-sm); text-decoration: none; min-height: 36px; padding-right: 8px; }
.back-link svg { width: 18px; height: 18px; transition: transform .3s var(--ease-spring); }
.back-link:hover svg { transform: translateX(-4px); }

/* bento */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; } .c-6 { grid-column: span 6; } .c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; } .c-12 { grid-column: span 12; }
@media (max-width: 1200px) { .c-3 { grid-column: span 6; } .c-4, .c-5 { grid-column: span 6; } .c-7, .c-8 { grid-column: span 12; } .c-6 { grid-column: span 6; } }
@media (max-width: 760px) { .bento { gap: 14px; } .c-3, .c-4, .c-5, .c-6, .c-7, .c-8 { grid-column: span 12; } .c-3.half { grid-column: span 6; } }

.stat { display: grid; gap: 4px; align-content: start; }
.stat .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; display: flex; align-items: center; gap: 8px; }
.stat .k svg { width: 16px; height: 16px; }
.stat .v { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem); letter-spacing: -.05em; line-height: 1; }
.stat .d { font-size: var(--fs-sm); font-weight: 600; }
.stat-card { min-height: 150px; text-decoration: none; display: grid; }
.stat-card .go { position: absolute; right: 16px; top: 16px; width: 36px; height: 36px; border-radius: 50%; border: var(--border); display: grid; place-items: center; background: var(--paper); transition: transform .4s var(--ease-spring); }
.stat-card .go svg { width: 16px; height: 16px; }
.stat-card:hover .go { transform: rotate(-45deg); }

/* list rows */
.list { display: grid; gap: 10px; }
.lrow { display: flex; align-items: center; gap: 14px; padding: 12px 14px; min-height: 64px; border: var(--border); border-radius: var(--r-md); background: var(--paper); text-decoration: none; text-align: left; width: 100%; transition: transform .2s var(--ease-out), box-shadow .2s, background-color .2s; }
a.lrow:hover, button.lrow:hover { transform: translate(-2px, -2px); box-shadow: var(--sh-sm); }
a.lrow:active, button.lrow:active { transform: translate(1px, 1px); box-shadow: none; }
.lrow .thumb { width: 72px; height: 50px; border-radius: 12px; overflow: hidden; border: 2px solid var(--ink); flex: none; background: var(--ink); position: relative; }
.lrow .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lrow .thumb.sq { width: 50px; }
.lrow .meta { min-width: 0; flex: 1; }
.lrow .meta b { display: block; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .meta small { display: block; color: var(--ink-soft); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lrow .end { display: flex; align-items: center; gap: 8px; flex: none; }
.lrow .chev { width: 18px; height: 18px; flex: none; }
.lrow.is-done { opacity: .6; }

/* filters bar */
.fbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.fbar .input-icon { flex: 1 1 260px; max-width: 380px; }
.fbar .select { width: auto; min-width: 160px; min-height: 44px; padding-block: 8px; }
@media (max-width: 600px) { .fbar .select { flex: 1 1 140px; } }

/* media grid */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 20px; }

/* Sheet nav (mobile "More") */
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.more-grid a { display: grid; justify-items: center; gap: 8px; padding: 14px 6px; border: var(--border); border-radius: var(--r-md); background: var(--paper); text-decoration: none; font-weight: 700; font-size: 13px; text-align: center; min-height: 96px; align-content: center; }
.more-grid a .ni { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--ink); display: grid; place-items: center; background: var(--cream); }
.more-grid a .ni svg { width: 20px; height: 20px; }
.more-grid a[aria-current="page"] { background: var(--sun); }

/* Bottom tab bar (mobile) */
.tabbar { display: none; }
@media (max-width: 1023px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { padding: calc(10px + var(--safe-t)) 16px 10px; background: var(--cream); border-bottom: 2px solid transparent; transition: border-color .2s; }
  .topbar.is-scrolled { border-bottom-color: var(--ink); }
  .topbar .tb-title { display: block; }
  .topbar .search-trigger { flex: none; width: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .topbar .search-trigger span, .topbar .search-trigger .kbd { display: none; }
  .view { padding: 4px 16px calc(130px + var(--safe-b)); }
  .vhead { margin-top: 0; }
  .tabbar {
    display: flex; position: fixed; z-index: 700; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); height: 72px;
    background: var(--paper); border: var(--border); border-radius: 26px; box-shadow: var(--sh-sm); align-items: center; justify-content: space-around; padding: 0 6px;
  }
  .tabbar a, .tabbar button { flex: 1; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 800; text-decoration: none; min-height: 56px; align-content: center; border-radius: 18px; position: relative; color: var(--ink); }
  .tabbar a svg, .tabbar button svg { width: 22px; height: 22px; transition: transform .35s var(--ease-spring); }
  .tabbar [aria-current="page"] { color: var(--ink); }
  .tabbar [aria-current="page"] .tbi { background: var(--sun); border-color: var(--ink); }
  .tabbar .tbi { width: 44px; height: 32px; border-radius: 12px; display: grid; place-items: center; border: 2px solid transparent; transition: background-color .2s; }
  .tabbar a:active svg { transform: scale(.8); }
  .tabbar .tb-count { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 20px; height: 20px; font-size: 11px; }
  .tabbar .rec-dock { flex: 0 0 88px; }
  .rec-fab { position: relative; top: -22px; width: 76px; height: 76px; border-radius: 50%; background: var(--tomato); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); display: grid; place-items: center; transition: transform .2s var(--ease-squish), box-shadow .2s; }
  .rec-fab::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--tomato); opacity: .5; animation: ring 2.2s var(--ease-out) infinite; }
  .rec-fab i.dot { width: 26px; height: 26px; border-radius: 50%; background: var(--paper); border: 3px solid var(--ink); }
  .rec-fab:active { transform: scale(.88); box-shadow: 0 0 0 var(--ink); }
  .tabbar .rec-dock span.lbl { position: absolute; bottom: 4px; font-size: 11px; font-weight: 800; }
}
@keyframes ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.3); opacity: 0; } }

/* swipeable row cards (mobile horizontal scroll) */
.hscroll { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 14px; margin-inline: -4px; scrollbar-width: none; overscroll-behavior-x: contain; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: 0 0 min(78%, 300px); }

/* swipe-to-action card */
.swipe { position: relative; border-radius: var(--r-md); overflow: hidden; touch-action: pan-y; }
.swipe .sw-under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-weight: 800; border: var(--border); border-radius: var(--r-md); }
.swipe .sw-under .l { display: flex; align-items: center; gap: 8px; }
.swipe .sw-under svg { width: 20px; height: 20px; }
.swipe .sw-top { position: relative; z-index: 2; }

/* household switcher */
.hh-switch { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: var(--border); border-radius: var(--r-pill); background: var(--paper); font-weight: 700; min-height: 48px; transition: box-shadow .2s, transform .2s; max-width: 100%; }
.hh-switch:hover { box-shadow: var(--sh-xs); transform: translate(-1px,-1px); }
.hh-switch .avatar { --sz: 34px; }
.hh-switch .t { display: grid; text-align: left; line-height: 1.1; min-width: 0; }
.hh-switch .t small { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.hh-switch .t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-switch > svg { width: 18px; height: 18px; flex: none; }
@media (max-width: 1023px) { .hh-switch .t small { display: none; } .hh-switch { min-height: 44px; } }
@media (max-width: 420px) { .hh-switch .t { display: none; } .hh-switch { padding: 4px; } }

/* popover menu */
.pop { position: absolute; z-index: 900; min-width: 260px; padding: 8px; background: var(--paper); border: var(--border); border-radius: var(--r-md); box-shadow: var(--sh); }
.pop button, .pop a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 12px; text-align: left; font-weight: 700; text-decoration: none; min-height: 48px; }
.pop button:hover, .pop a:hover { background: var(--cream); }
.pop .is-sel { background: var(--sun-tint); }
.pop hr { margin: 6px 0; border-top: 2px dashed var(--line-soft); }

/* view transition helper */
.view-enter { animation: viewIn .35s var(--ease-out); }
@keyframes viewIn { from { transform: translateY(12px); } }

/* Command palette */
.cmdk-root { position: fixed; inset: 0; z-index: 9100; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.cmdk-root .modal-scrim { position: absolute; inset: 0; }
.cmdk { position: relative; width: min(100%, 640px); background: var(--cream); border: var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-lg); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: var(--border); background: var(--paper); }
.cmdk-in svg { width: 22px; height: 22px; flex: none; }
.cmdk-in input { flex: 1; border: 0; background: transparent; font-size: 1.15rem; font-weight: 600; min-height: 40px; outline: none; }
.cmdk-list { max-height: min(56vh, 480px); overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 14px; text-align: left; min-height: 52px; font-weight: 700; }
.cmdk-item .ci { width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--ink); display: grid; place-items: center; background: var(--paper); flex: none; overflow: hidden; }
.cmdk-item .ci img { width: 100%; height: 100%; object-fit: cover; }
.cmdk-item .ci svg { width: 18px; height: 18px; }
.cmdk-item small { display: block; font-weight: 600; color: var(--ink-soft); font-size: 12px; }
.cmdk-item .hint { margin-left: auto; font-size: 12px; color: var(--ink-soft); }
.cmdk-item.is-act { background: var(--sun); }
.cmdk-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 2px dashed var(--line-soft); font-size: 12px; font-weight: 700; color: var(--ink-soft); flex-wrap: wrap; }
.cmdk-foot .kbd { color: var(--ink); min-width: 22px; height: 22px; }
@media (max-width: 640px) { .cmdk-root { padding-top: calc(12px + var(--safe-t)); } }

/* misc */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.section-title h2 { font-size: var(--fs-xl); margin: 0; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; font-size: var(--fs-sm); }
.kv dt { font-weight: 800; color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 600; }
.dot-sep::before { content: "·"; margin: 0 6px; }
.timeline { position: relative; display: grid; gap: 18px; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 8px; bottom: 8px; width: 3px; background: repeating-linear-gradient(var(--ink) 0 6px, transparent 6px 12px); }
.tl-item { position: relative; }
.tl-item::before { content: ""; position: absolute; left: -26px; top: 18px; width: 18px; height: 18px; border-radius: 50%; background: var(--sun); border: 3px solid var(--ink); }
.tl-item.is-future::before { background: var(--paper); }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: 10px; }
.bar-chart .b { flex: 1; display: grid; justify-items: center; gap: 6px; height: 100%; align-content: end; font-size: 11px; font-weight: 800; }
.bar-chart .b i { display: block; width: 100%; border: 2px solid var(--ink); border-radius: 8px 8px 4px 4px; background: var(--sky); transform-origin: bottom; }
.bar-chart .b.is-now i { background: var(--tomato); }
.spark { width: 100%; height: 70px; }
.meter { position: relative; height: 22px; border: var(--border); border-radius: 12px; background: var(--paper); overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--grass); border-right: 2px solid var(--ink); }
.meter .ceil { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--ink); }

/* Coming-soon dog profile preview (portal) */
.profile-cover { position: relative; height: clamp(180px, 28vw, 300px); border: 3px solid var(--ink); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh); }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; }
.profile-head { display: flex; align-items: flex-end; gap: 18px; margin: -60px 0 20px 24px; position: relative; z-index: 2; flex-wrap: wrap; }
.profile-head .avatar { --sz: 120px; border-width: 4px; box-shadow: var(--sh-sm); }
.cs-ribbon { position: absolute; right: 18px; top: 18px; transform: rotate(4deg); }
svg.inline-ic { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.chip[aria-current="true"] { background: var(--ink); color: var(--cream); }
.swipe-hint { display: none; font-size: 12px; font-weight: 700; color: var(--ink-soft); align-items: center; gap: 6px; margin-bottom: 10px; }
.swipe-hint svg { width: 16px; height: 16px; }
@media (hover: none) { .swipe-hint { display: flex; } }

/* ---------- List rows: never overflow ---------- */
.lrow, .member, .pref, .side-user { min-width: 0; max-width: 100%; }
.lrow .meta, .member .meta { flex: 1 1 140px; min-width: 0; }
.lrow .meta b, .lrow .meta small { max-width: 100%; }
.lrow .end { flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; margin-left: auto; }
@media (max-width: 600px) {
  .lrow, .member { flex-wrap: wrap; }
  .lrow .end, .member > .pill, .member > .btn { flex: 0 1 auto; }
  .lrow .end { flex-basis: 100%; justify-content: flex-start; padding-left: 0; }
  .lrow .thumb + .meta ~ .end, .lrow .avatar + .meta ~ .end, .lrow .avatars + .meta ~ .end { padding-left: 64px; }
  .member { row-gap: 8px; }
  .pref { flex-wrap: wrap; }
  .table--stack td { flex-wrap: wrap; min-width: 0; }
  .table--stack td > * { min-width: 0; max-width: 100%; }
  .up-row .meta b { white-space: normal; }
}
.pick-grid > *, .sel-tiles > *, .pick-media > *, .covers > *, .list > *, .hscroll > * { min-width: 0; }
