/* ============================================================================
 * Grace Arena Fitness — Design System v2 ("Premium")
 * ----------------------------------------------------------------------------
 * Goals: modern, polished, trustworthy. Mobile-first. No framework, no web
 * fonts (stays offline-capable & fast on Opera Mini / low-end Android).
 *
 * Every class name and CSS variable used by js/app.js is preserved, so this is
 * a pure visual upgrade — no JS changes required.
 *
 * (Optional) For an even more "designed" feel you can add Inter:
 *   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 *   <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400..800&display=swap" rel="stylesheet">
 *   then set  --font: 'Inter', system-ui, ...  below. (Not done by default to
 *   keep the app fully offline.)
 * ==========================================================================*/

/* ----------------------------------------------------------------- Tokens */
:root {
  /* Brand — Grace Arena Fitness blue + yellow */
  --brand:   #1d4ed8;
  --brand-2: #4f7bff;   /* lighter, for gradients/highlights */
  --brand-d: #16319c;   /* deep, for gradient ends */
  --accent:  #f5c518;   /* GAF yellow */
  --accent-d:#e0ad00;

  /* Semantic (success/warn/danger) — kept distinct from brand */
  --green:   #16a34a;
  --green-d: #15803d;
  --red:     #e11d48;
  --yellow:  #d97706;
  --blue:    #2563eb;
  --gold:    #f59e0b;

  /* Surfaces & text */
  --bg:        #eef2f9;
  --bg-2:      #e6ecf6;
  --card:      #ffffff;
  --surface-2: #f4f7fc;
  --text:      #0c1322;
  --muted:     #6a7793;
  --border:    #e6ebf3;
  --input:     #f4f7fc;
  --nav-bg:    rgba(255,255,255,.82);

  /* Effects */
  --ring:      0 0 0 4px rgba(29,78,216,.16);
  --shadow-sm: 0 1px 2px rgba(13,22,44,.06);
  --shadow:    0 6px 18px -6px rgba(13,22,44,.14), 0 2px 6px -2px rgba(13,22,44,.06);
  --shadow-lg: 0 22px 48px -16px rgba(13,22,44,.28), 0 6px 16px -8px rgba(13,22,44,.16);
  --shadow-brand: 0 10px 22px -8px rgba(29,78,216,.55);
  --shadow-accent: 0 10px 22px -8px rgba(245,197,24,.5);

  /* Radii */
  --r-xs: 9px; --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-xl: 28px;

  --nav-h: 84px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 560px;
}
[data-theme="dark"] {
  --brand:   #4f7bff;
  --brand-2: #6f93ff;
  --brand-d: #1e3a8a;
  --accent:  #facc15;
  --accent-d:#eab308;
  --green:   #22c55e;
  --red:     #fb7185;

  --bg:        #070b16;
  --bg-2:      #0a1120;
  --card:      #0f1726;
  --surface-2: #131d31;
  --text:      #e9eef8;
  --muted:     #8a98b6;
  --border:    #1e2942;
  --input:     #131d31;
  --nav-bg:    rgba(15,23,38,.78);

  --ring:      0 0 0 4px rgba(79,123,255,.22);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 8px 22px -8px rgba(0,0,0,.6), 0 2px 8px -3px rgba(0,0,0,.5);
  --shadow-lg: 0 26px 52px -16px rgba(0,0,0,.7);
  --shadow-brand: 0 10px 26px -8px rgba(79,123,255,.5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 520px at 50% -10%, rgba(29,78,216,.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.5;
  letter-spacing: .002em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(79,123,255,.16), transparent 60%),
    var(--bg);
}
img { max-width: 100%; display: block; }

/* The `hidden` attribute only sets display:none via the UA stylesheet, so any
   explicit `display` in a class (.notif-badge is display:grid, .tab-count is
   inline-grid) silently defeats it — badges then render "0" instead of hiding.
   This makes hidden mean hidden everywhere. */
[hidden] { display: none !important; }

/* Sample-data ribbon — deliberately loud, so an invented gym is never mistaken
   for a real one. Sits above everything, including the offline banner. */
.demo-ribbon {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  background: var(--gold, #f59e0b); color: #1a1206;
  font-size: .74rem; font-weight: 700; letter-spacing: .02em;
  text-align: center; padding: 5px 10px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.25);
}
.demo-ribbon[hidden] { display: none; }
.demo-ribbon button {
  background: rgba(0,0,0,.16); color: inherit; border: 0; cursor: pointer;
  font: inherit; padding: 3px 9px; border-radius: 999px;
}
.demo-ribbon button:hover { background: rgba(0,0,0,.28); }
body.has-demo-ribbon .app { padding-top: 26px; }
a { color: var(--brand); text-decoration: none; }
h1,h2,h3,h4 { margin: 0 0 .4rem; line-height: 1.2; letter-spacing: -.018em; font-weight: 750; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.28rem; } h3 { font-size: 1.06rem; }
small, .muted { color: var(--muted); }
::selection { background: rgba(29,78,216,.2); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 12px; }

/* --------------------------------------------------------------- Layout */
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; position: relative; }
.screen { display: none; }
.screen.active { display: block; animation: screenIn .32s cubic-bezier(.22,.7,.3,1); }
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view { padding: 16px 15px calc(var(--nav-h) + 16px); }
.view-no-nav { padding-bottom: 28px; }

/* --------------------------------------------------------------- Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(120deg, var(--brand), var(--brand-d));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; gap: 10px;
  box-shadow: 0 6px 20px -10px rgba(13,22,44,.5);
}
.topbar::after { /* thin accent line */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-d));
}
.topbar h1 { font-size: 1.08rem; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { font-size: .72rem; opacity: .9; display: block; font-weight: 500; letter-spacing: .01em; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.18); color: #fff;
  width: 40px; height: 40px; border-radius: 12px; font-size: 1.05rem;
  cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px);
  transition: transform .12s, background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.26); }
.icon-btn:active { transform: scale(.92); }

/* ---------------------------------------------------------------- Cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px; margin-bottom: 13px;
  box-shadow: var(--shadow);
  animation: cardIn .26s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.card h3 { font-size: 1.02rem; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------------------------------------------------------------- Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 13px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 15px 8px 13px; text-align: center; box-shadow: var(--shadow);
}
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); opacity: .9; }
.stat .num {
  font-size: 1.62rem; font-weight: 800; line-height: 1; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--text), var(--muted));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stat .lbl { font-size: .66rem; color: var(--muted); margin-top: 6px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; }
.stat.fire::before { background: linear-gradient(90deg, var(--gold), var(--accent)); }
.stat.fire .num { background: linear-gradient(180deg, #f59e0b, #d97706);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* -------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; border-radius: 13px; padding: 13px 17px; font-size: .94rem;
  font-weight: 650; cursor: pointer; color: #fff; font-family: inherit;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  box-shadow: var(--shadow-brand); text-decoration: none; line-height: 1;
  letter-spacing: .005em; transition: transform .08s ease, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 17px; font-size: 1.04rem; border-radius: 16px; }

.btn-outline { background: var(--card); border: 1.5px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); filter: none; }
.btn-ghost { background: transparent; color: var(--muted); box-shadow: none; }
.btn-blue   { background: linear-gradient(135deg, #4f8bff, var(--blue)); box-shadow: 0 10px 22px -8px rgba(37,99,235,.5); }
.btn-red    { background: linear-gradient(135deg, #fb6f8a, var(--red)); box-shadow: 0 10px 22px -8px rgba(225,29,72,.5); }
.btn-yellow { background: linear-gradient(135deg, #f0b429, var(--yellow)); box-shadow: 0 10px 22px -8px rgba(217,119,6,.5); }
.btn-green  { background: linear-gradient(135deg, #2fbf6b, var(--green)); box-shadow: 0 10px 22px -8px rgba(22,163,74,.5); }
.btn-gold   { background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #3a2c00; box-shadow: var(--shadow-accent); }
.btn-wa     { background: linear-gradient(135deg, #2be676, #17b85b); color: #04340f; box-shadow: 0 10px 22px -8px rgba(37,211,102,.5); }
.btn-sm { padding: 9px 12px; font-size: .8rem; border-radius: 10px; gap: 5px; }

/* The big hero check-in button */
.checkin-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, var(--brand-2), var(--brand) 55%, var(--brand-d));
  color: #fff; border: none; width: 100%; border-radius: var(--r-xl);
  padding: 36px 18px; font-size: 1.32rem; font-weight: 800; cursor: pointer;
  box-shadow: 0 18px 40px -16px rgba(29,78,216,.7); margin-bottom: 14px;
  letter-spacing: -.01em; transition: transform .1s;
}
.checkin-hero::before { /* glossy radial sheen */
  content: ""; position: absolute; width: 240px; height: 240px; right: -50px; top: -90px;
  background: radial-gradient(circle, rgba(255,255,255,.32), transparent 70%);
}
.checkin-hero::after { /* accent ring bottom-left */
  content: ""; position: absolute; width: 180px; height: 180px; left: -60px; bottom: -90px;
  border-radius: 50%; border: 18px solid rgba(245,197,24,.18);
}
.checkin-hero .em { font-size: 2.7rem; display: block; margin-bottom: 8px; position: relative; }
.checkin-hero:active { transform: scale(.98); }
.checkin-hero.done {
  background: linear-gradient(150deg, #475569, #1e293b);
  box-shadow: var(--shadow); }
.checkin-hero.done::after { border-color: rgba(34,197,94,.25); }

/* ---------------------------------------------------------------- Forms */
label { display: block; font-size: .8rem; font-weight: 650; margin: 12px 0 6px; color: var(--text); }
input, select, textarea {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--border);
  border-radius: 13px; font-size: 1rem; background: var(--input); color: var(--text);
  font-family: inherit; transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 1.15em, calc(100% - 13px) 1.15em; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: var(--card); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 86px; resize: vertical; }
.field-hint { font-size: .73rem; color: var(--muted); margin-top: 5px; line-height: 1.4; }

/* --------------------------------------------------------------- Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; line-height: 1; letter-spacing: .01em; border: 1px solid transparent; }
.badge-green  { background: rgba(22,163,74,.12); color: var(--green); border-color: rgba(22,163,74,.2); }
.badge-red    { background: rgba(225,29,72,.12); color: var(--red); border-color: rgba(225,29,72,.2); }
.badge-yellow { background: rgba(217,119,6,.14); color: var(--yellow); border-color: rgba(217,119,6,.22); }
.badge-gold   { background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #3a2c00; box-shadow: var(--shadow-accent); border: none; }
.badge-gray   { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge-blue   { background: rgba(37,99,235,.12); color: var(--blue); border-color: rgba(37,99,235,.2); }

/* ----------------------------------------------------------- List rows */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border);
  transition: background .12s; border-radius: 12px; }
.list-row:last-child { border-bottom: none; }
.list-row[style*="cursor"]:hover, .list-row[data-member]:hover { background: var(--surface-2); }
.avatar { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff;
  display: grid; place-items: center; font-weight: 750; font-size: .92rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 4px 10px -4px rgba(29,78,216,.5); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { font-size: .76rem; color: var(--muted); }

/* ----------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 7px; overflow-x: auto; padding: 11px 15px 6px; position: sticky;
  top: 64px; background: linear-gradient(var(--bg), var(--bg) 70%, transparent); z-index: 15;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; padding: 9px 15px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); font-size: .84rem; font-weight: 650; cursor: pointer; color: var(--muted);
  box-shadow: var(--shadow-sm); transition: all .15s; }
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; border-color: transparent; box-shadow: var(--shadow-brand); }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

/* ------------------------------------------------------- Bottom nav bar */
.bottomnav {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 26px); max-width: 534px; height: 64px;
  background: var(--nav-bg); border: 1px solid var(--border);
  border-radius: 22px; display: flex; z-index: 30;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(16px) saturate(1.4);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.navbtn { flex: 1; background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: .62rem; font-weight: 600; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 6px 0; transition: color .15s; }
.navbtn .ic { font-size: 1.18rem; width: 46px; height: 30px; display: grid; place-items: center;
  border-radius: 11px; transition: background .18s, transform .18s; }
.navbtn.active { color: var(--brand); font-weight: 750; }
.navbtn.active .ic { background: linear-gradient(135deg, rgba(79,123,255,.18), rgba(29,78,216,.16)); transform: translateY(-1px); }
.navbtn:active .ic { transform: scale(.9); }

/* ----------------------------------------------------- Search & chips */
.search-bar { display: flex; gap: 9px; margin-bottom: 13px; }
.search-bar input { flex: 1; }
.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 9px; margin-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); font-size: .8rem; font-weight: 600; cursor: pointer; color: var(--muted);
  box-shadow: var(--shadow-sm); transition: all .15s; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ------------------------------------------------------- Business cards */
.biz-card { position: relative; overflow: hidden; }
.biz-card.featured { border-color: rgba(245,197,24,.55); box-shadow: 0 0 0 1.5px rgba(245,197,24,.55), var(--shadow); }
.biz-card.featured::before { content: ""; position: absolute; right: -40px; top: -40px; width: 110px; height: 110px;
  background: radial-gradient(circle, rgba(245,197,24,.22), transparent 70%); }
.biz-imgs { display: flex; gap: 7px; margin: 10px 0; }
.biz-imgs img { width: 33%; height: 80px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
.biz-imgs .ph { width: 100%; height: 80px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border);
  display: grid; place-items: center; color: var(--muted); font-size: .7rem; }

/* ------------------------------------------------------------- Carousel */
.carousel { display: flex; gap: 12px; overflow-x: auto; padding: 4px 15px 14px; margin: 0 -15px;
  scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel .biz-card { min-width: 80%; scroll-snap-align: start; margin-bottom: 0; }
.section-title { padding: 8px 0 4px; font-size: .72rem; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; }

/* ---------------------------------------------------------------- Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(7,11,22,.55); z-index: 50;
  display: none; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px);
  animation: fadeIn .2s ease; }
.modal-overlay.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); width: 100%; max-width: var(--maxw); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 14px 18px 24px; max-height: 90vh; overflow-y: auto; position: relative;
  box-shadow: var(--shadow-lg); animation: slideUp .28s cubic-bezier(.22,.7,.3,1); }
.modal::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 99px;
  background: var(--border); margin: 2px auto 14px; }
@keyframes slideUp { from { transform: translateY(60px); } to { transform: none; } }
.modal h3 { font-size: 1.14rem; padding-right: 38px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: var(--surface-2); border: 1px solid var(--border);
  width: 34px; height: 34px; border-radius: 50%; font-size: .95rem; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--text); }

/* ---------------------------------------------------------------- Login */
#screen-login { position: relative; }
.auth-hero { position: absolute; inset: 0 0 auto 0; height: 320px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(420px 280px at 22% 8%, rgba(245,197,24,.20), transparent 60%),
    radial-gradient(520px 360px at 85% -8%, rgba(79,123,255,.32), transparent 60%);
}
.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; padding: 30px 20px 36px; max-width: 440px; margin: 0 auto; }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 26px 22px; box-shadow: var(--shadow-lg); margin-bottom: 14px; }
.logo-badge { width: 84px; height: 84px; border-radius: 24px; overflow: hidden; margin: 0 auto 16px;
  box-shadow: 0 14px 30px -10px rgba(29,78,216,.6), inset 0 0 0 1px rgba(255,255,255,.15); }
.logo-badge img { width: 100%; height: 100%; }
.brand-tag { text-align: center; font-weight: 800; letter-spacing: .16em; color: var(--accent-d);
  text-transform: uppercase; font-size: .68rem; margin: -2px 0 8px; }
[data-theme="dark"] .brand-tag { color: var(--accent); }
.auth-card h1 { text-align: center; }
.demo-accts { font-size: .8rem; }
.demo-accts button { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 12px; margin: 6px 6px 0 0; cursor: pointer; color: var(--text); font-size: .8rem; font-weight: 600;
  transition: all .15s; }
.demo-accts button:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }

/* ---------------------------------------------------------------- Toast */
.toast { position: fixed; bottom: calc(var(--nav-h) + 8px); left: 50%; transform: translateX(-50%) translateY(8px);
  background: rgba(12,19,34,.92); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .86rem;
  font-weight: 600; z-index: 100; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none;
  max-width: 90%; text-align: center; box-shadow: var(--shadow-lg); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.1); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------------------------------------------------------- Offline banner */
.offline-banner { background: linear-gradient(135deg, var(--accent), var(--accent-d)); color: #3a2c00;
  text-align: center; font-size: .8rem; font-weight: 650; padding: 8px; display: none; }
.offline-banner.show { display: block; }

/* -------------------------------------------------------------- Utility */
.row-gap { display: flex; gap: 9px; flex-wrap: wrap; }
.mt { margin-top: 11px; } .mb { margin-bottom: 11px; }
.empty { text-align: center; color: var(--muted); padding: 34px 14px; font-size: .9rem; }
.empty::before { content: "📭"; display: block; font-size: 2rem; margin-bottom: 8px; opacity: .8; }
.divider { height: 1px; background: var(--border); margin: 13px 0; }
.pill-link { font-size: .84rem; font-weight: 650; color: var(--brand); cursor: pointer; }
.pill-link:hover { text-decoration: underline; }
details.howto { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 4px 16px;
  margin-bottom: 13px; box-shadow: var(--shadow-sm); }
details.howto summary { cursor: pointer; font-weight: 700; padding: 12px 0; list-style: none; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto[open] summary { color: var(--brand); }
details.howto li { margin: 6px 0; font-size: .87rem; }
.kbd { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px;
  font-size: .78rem; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--text); }

/* --------------------------------------------------- Notifications */
.icon-btn.bell { position: relative; overflow: visible; }
.notif-badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px;
  padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: .62rem;
  font-weight: 800; display: grid; place-items: center; border: 2px solid var(--brand);
  box-shadow: 0 2px 6px rgba(225,29,72,.5); animation: pop .25s ease; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: .64rem; font-weight: 800;
  margin-left: 5px; vertical-align: middle; }
.tab.active .tab-count { background: rgba(255,255,255,.28); }

.notif-item { display: flex; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--border); border-radius: 12px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(29,78,216,.06); }
[data-theme="dark"] .notif-item.unread { background: rgba(79,123,255,.1); }
.notif-ic { font-size: 1.35rem; width: 44px; height: 44px; border-radius: 13px; background: var(--surface-2);
  display: grid; place-items: center; flex-shrink: 0; }
.notif-item.unread .notif-ic { background: rgba(29,78,216,.14); }
.notif-title { font-weight: 700; font-size: .92rem; }
.notif-item.unread .notif-title::after { content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--brand); margin-left: 7px; vertical-align: middle; }
.notif-body { font-size: .84rem; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: .71rem; color: var(--muted); margin-top: 5px; font-weight: 600; }

/* ----------------------------------------------------- Image uploader */
.img-uploader { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.img-uploader .thumb { position: relative; width: 88px; height: 88px; border-radius: 13px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.img-uploader .thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-uploader .thumb-x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(7,11,22,.72); color: #fff; border: none; cursor: pointer; font-size: .72rem; line-height: 1;
  display: grid; place-items: center; }
.img-uploader .thumb-empty { font-size: .8rem; color: var(--muted); padding: 12px 4px; }
.receipt-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-top: 10px;
  border: 1px solid var(--border); cursor: zoom-in; }

/* ------------------------------------------------------- Streak ring */
.stats-2 { grid-template-columns: repeat(2, 1fr); }
.ring-card { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 104px; height: 104px; flex-shrink: 0; }
.ring svg { display: block; }
.ring-progress { transition: stroke-dashoffset 1s cubic-bezier(.22,.7,.3,1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.03em;
  background: linear-gradient(180deg, var(--brand-2), var(--brand)); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; }
.ring-sub { font-size: .62rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.ring-side { flex: 1; min-width: 0; }
.ring-goal { font-size: .92rem; line-height: 1.35; }
.ring-segs { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.ring-segs .seg { font-size: .68rem; font-weight: 700; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.ring-segs .seg.on { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; border-color: transparent;
  box-shadow: 0 4px 10px -4px rgba(29,78,216,.5); }

/* ------------------------------------------------------- Hero card */
.hero-card { background: linear-gradient(150deg, var(--brand-2), var(--brand) 55%, var(--brand-d)) !important;
  position: relative; overflow: hidden; box-shadow: 0 14px 32px -14px rgba(29,78,216,.7); }
.hero-card::after { content: ""; position: absolute; width: 150px; height: 150px; right: -40px; bottom: -70px;
  border-radius: 50%; border: 16px solid rgba(245,197,24,.16); }

/* ----------------------------------------------------- Pending screen */
.pending-emoji { font-size: 3.6rem; margin-bottom: 4px; animation: floaty 2.6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* ----------------------------------------------------------- Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 15px; border-radius: 2px;
  animation: confFall 1.5s cubic-bezier(.3,.6,.5,1) forwards; }
@keyframes confFall { to { transform: translateY(106vh) rotate(620deg); opacity: .15; } }

/* --------------------------------------------------- Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
