/* Primal member app. Palette and scale follow the Nov 19 redesign (the live site's colours).
   Type is the system stack for now: Harmonia goes in once the app sits on a Primal address
   the font licence covers. */
:root {
  color-scheme: light;
  --paper: #EDE8D2; --raised: #F7F3E7; --taupe: #DCCFB9; --line: #CFC5AE; --line-strong: #B9AE95;
  --ink: #132238; --mid: #57534A; --accent: #D4B906; --accent-text: #6E5E00;
  --forest: #303F16; --clay: #9A3716; --on-dark: #E2DECF;
  --display: "Harmonia", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --tab-h: 66px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.app { max-width: 480px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; position: relative; background: var(--paper); padding-bottom: calc(var(--tab-h) + 44px + env(safe-area-inset-bottom)); }
.app.bare { padding-bottom: 0; }
.boot { padding: 40vh 24px 0; text-align: center; color: var(--mid); }

.eyebrow { font: 600 12px/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mid); }
.eyebrow.accent { color: var(--accent-text); }
.display { font: 300 36px/1.05 var(--display); letter-spacing: -0.01em; }
.h2 { font: 300 24px/1.15 var(--display); }
.meta { color: var(--mid); font-size: 13px; }
.pad { padding: 0 20px; }
.top { padding-top: calc(18px + env(safe-area-inset-top)); }
.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; border: 0; background: none; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--clay); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid var(--ink); border-radius: 8px; background: transparent; color: var(--ink); text-decoration: none; font: 600 14px/1 var(--display); letter-spacing: 0.04em; }
.btn.primary { border-color: var(--accent); background: var(--accent); }
.btn.big { min-height: 54px; border-radius: 10px; font-size: 16px; width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn.small { min-width: 86px; padding: 0 12px; font-size: 13px; }

/* hero */
.hero { position: relative; height: 300px; overflow: hidden; background: var(--forest); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(19,34,56,0.5) 0%, rgba(19,34,56,0.22) 42%, rgba(19,34,56,0.82) 100%); }
.hero .words { position: absolute; left: 20px; right: 20px; bottom: 66px; display: flex; flex-direction: column; gap: 6px; color: #fff; }
.hero .words .eyebrow { color: var(--paper); }
.hero .display { font-size: 42px; }
.hero .chip { position: absolute; left: 20px; top: calc(18px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px 0 10px; border: 1px solid rgba(255,255,255,0.5); border-radius: 22px; background: rgba(255,255,255,0.16); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); color: #fff; font: 600 13px/1 var(--display); letter-spacing: 0.04em; }

.card { position: relative; margin: -44px 20px 0; padding: 16px; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 28px rgba(19,34,56,0.12); display: flex; flex-direction: column; gap: 14px; }
.card .thumb { width: 76px; height: 92px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.card .head { display: flex; gap: 14px; }
.card .head > div { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.card .foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.card h2 { font: 300 26px/1.1 var(--display); }

.section { margin: 30px 20px 0; display: flex; flex-direction: column; gap: 14px; }
.rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring .dial { position: relative; width: 88px; height: 88px; }
.ring .dial svg { position: absolute; inset: 0; }
.ring .dial span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 300 30px/1 var(--display); }
.ring p { font: 600 13px/1.2 var(--display); letter-spacing: 0.04em; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--taupe); border-radius: 12px; }
.stats div { padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.stats div + div { border-left: 1px solid #C2B499; }
.stats b { font: 300 28px/1 var(--display); }
.stats span { color: #4E4A42; font-size: 12px; }

/* lists */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.list .item:last-child { border-bottom: 1px solid var(--line); }
.item.mine { margin: 0 -20px; padding-left: 20px; padding-right: 20px; background: var(--raised); }
.item.past { opacity: 0.55; }
.item .when { width: 64px; flex-shrink: 0; display: flex; flex-direction: column; gap: 3px; }
.item .when b { font: 300 21px/1 var(--display); }
.item .when span { color: var(--mid); font-size: 12px; }
.item .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item .what b { font-size: 16px; font-weight: 500; }
.item .what span { color: var(--mid); font-size: 13px; }
.tag { display: inline-flex; align-items: center; gap: 5px; min-width: 86px; justify-content: center; color: var(--accent-text); font: 600 12px/1 var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.tag.muted { color: var(--mid); }
.warn { color: var(--clay); font-weight: 500; }

.tabs { display: flex; gap: 24px; margin-top: 10px; border-bottom: 1px solid var(--line); }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.day { position: relative; height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 10px; background: transparent; }
.day small { color: var(--mid); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.day b { font: 300 21px/1 var(--display); }
.day[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.day[aria-pressed="true"] small { color: var(--paper); }
.day i { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 3px; background: var(--accent-text); }
.day[aria-pressed="true"] i { background: var(--accent); }
.empty { padding: 28px 0; color: var(--mid); text-align: center; }
.note { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); color: var(--mid); font-size: 13px; }
.alert { padding: 12px 14px; border: 1px solid #C98E78; border-radius: 10px; background: var(--raised); color: var(--clay); font-size: 14px; }

/* class detail */
.photo { position: relative; height: 280px; overflow: hidden; background: var(--forest); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(19,34,56,0.5) 0%, rgba(19,34,56,0) 45%); }
.round { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 20px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.7); border-radius: 22px; background: rgba(247,243,231,0.62); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); color: var(--ink); }
.sheet { position: relative; margin-top: -22px; padding: 24px 20px 0; background: var(--paper); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; gap: 18px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--mid); font-size: 14px; }
.facts span { display: flex; align-items: center; gap: 6px; }
.who { display: flex; align-items: center; gap: 12px; min-height: 62px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 19px; background: #453A1D; color: var(--paper); display: flex; align-items: center; justify-content: center; font: 600 13px/1 var(--display); }
.item .what .going { display: flex; align-items: center; gap: 7px; margin-top: 2px; color: var(--ink); font-size: 13px; }
.mini-stack { display: flex; padding-left: 6px; }
.mini { width: 22px; height: 22px; margin-left: -6px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid var(--paper); object-fit: cover; color: #fff; display: flex; align-items: center; justify-content: center; font: 600 8px/1 var(--display); background: var(--taupe); }
.item.mine .mini { border-color: var(--raised); }
.item .what .going .mini { color: #fff; font: 600 8px/1 var(--display); }
.item .what .going > span:last-child { color: var(--mid); font-size: 13px; }
.ghost { background: var(--line) !important; animation: ghost 1.6s ease-in-out infinite; }
.mini.ghost:nth-child(2), .who-face.ghost:nth-child(2) { animation-delay: .2s; }
.mini.ghost:nth-child(3), .who-face.ghost:nth-child(3) { animation-delay: .4s; }
.item .what .going .ghost.bar { width: 86px; height: 9px; border-radius: 5px; animation-delay: .6s; }
@keyframes ghost { 0%, 100% { opacity: .9; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .ghost { animation: none; } }
.who.going { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 0; border-top: 0; }
.who-row { display: flex; align-items: center; gap: 12px; }
.who-stack { display: flex; padding-left: 9px; }
.who-face { width: 34px; height: 34px; margin-left: -9px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--paper); object-fit: cover; color: #fff; display: flex; align-items: center; justify-content: center; font: 600 11px/1 var(--display); background: var(--taupe); }
.who-face.small { width: 30px; height: 30px; margin-left: 0; border: 0; }
.who-list { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.who-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.who-list li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
img.avatar { object-fit: cover; background: var(--taupe); }
.face { width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; object-fit: cover; vertical-align: -6px; background: var(--taupe); }
.avatar.big { width: 68px; height: 68px; border-radius: 34px; background: var(--ink); font: 300 26px/1 var(--display); }
.panel { position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 480px; transform: translateX(-50%); padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); background: var(--raised); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.panel .pair { display: flex; gap: 10px; }
.panel .pair .btn { flex: 1; }
.with-panel { padding-bottom: 220px; }

/* membership card */
.member { padding: 18px; border-radius: 12px; background: var(--forest); color: #fff; display: flex; flex-direction: column; gap: 6px; }
.member .eyebrow { color: #E8D76A; }
.member p { color: var(--on-dark); font-size: 14px; }
.phead { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.avatar.huge { width: 104px; height: 104px; margin-bottom: 8px; border-radius: 52px; border: 3px solid var(--raised); background: var(--ink); box-shadow: 0 6px 18px rgba(19,34,56,0.14); font: 300 36px/1 var(--display); }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 22px; padding: 4px; border-radius: 12px; background: var(--taupe); }
.seg button { height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--mid); font: 600 12px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; }
.seg button[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 3px rgba(19,34,56,0.12); }
.psec { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.item .amount { flex-shrink: 0; font: 400 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.item.nav { min-height: 62px; color: var(--ink); }
.item.nav svg { color: var(--mid); flex-shrink: 0; }
details.fold { margin-top: 18px; }
.pass { margin-top: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(19,34,56,0.08); }
.pass-who { display: flex; align-items: center; gap: 12px; }
.pass-who b { font-weight: 500; font-size: 17px; }
.barcode { display: block; width: 100%; height: 84px; }
details.dev { border-top: 1px solid var(--line); padding-top: 6px; }
details.dev summary { min-height: 44px; display: flex; align-items: center; color: var(--mid); font-size: 14px; cursor: pointer; }
details.dev p { color: var(--mid); font-size: 13px; padding: 2px 0; }

/* sign in */
.signin { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.signin .hero { height: 38vh; min-height: 220px; }
.signin .hero .words { bottom: 28px; }
.form { padding: 26px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field input { height: 50px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--raised); font-size: 16px; }

/* tab bar: glass */
.tabbar { position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); width: calc(100% - 32px); max-width: 448px; height: var(--tab-h); transform: translateX(-50%); padding: 0 6px; display: flex; align-items: center; background: rgba(247,243,231,0.58); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); border: 1px solid rgba(255,255,255,0.7); border-radius: 33px; box-shadow: 0 10px 30px rgba(19,34,56,0.18), inset 0 1px 0 rgba(255,255,255,0.75); z-index: 5; }
.tabbar a { flex: 1; height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--mid); font: 600 11px/1 var(--display); letter-spacing: 0.04em; border-radius: 28px; }
.tabbar a i { width: 18px; height: 3px; border-radius: 2px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] i { background: var(--accent); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .tabbar { background: rgba(247,243,231,0.96); } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 30px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: 420px; width: calc(100% - 40px); padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 14px; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 10; }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
