/* ==========================================================================
   Women of Rubies — Member Area (app shell)
   Sidebar on desktop · top bar + bottom tab bar on mobile
   ========================================================================== */

body.app { background: var(--rose-50); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) { body.app { padding-bottom: 0; } }

.app-shell { display: grid; min-height: 100vh; min-height: 100dvh; }
@media (min-width: 1024px) { .app-shell { grid-template-columns: 272px 1fr; } }

/* Sidebar */
.sidebar { display: none; }
@media (min-width: 1024px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 1.5rem; position: sticky; top: 0; height: 100vh;
    padding: 1.5rem 1.1rem; background: var(--ruby-950); color: #f3d6ef; overflow-y: auto;
  }
}
.sidebar .brand { color: #fff; padding: .25rem .5rem; }
.sidebar .brand-name small { color: var(--gold-300); }
.side-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.side-label { font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #b384ad; padding: 0 .85rem; margin: .25rem 0 .35rem; }
.side-nav a {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .85rem; border-radius: 12px;
  color: #f3d6ef; text-decoration: none; font-size: var(--fs-sm); font-weight: 500; transition: background .2s, color .2s;
}
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a[aria-current="page"] { background: linear-gradient(90deg, var(--ruby-700), var(--ruby-800)); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.side-nav svg.i { width: 20px; height: 20px; }
.side-card { margin-top: auto; padding: 1.1rem; border-radius: var(--radius); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); font-size: var(--fs-xs); }
.side-card strong { display: block; color: #fff; font-size: var(--fs-sm); margin-bottom: .25rem; }
.side-card .btn { margin-top: .75rem; width: 100%; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem var(--gutter); min-height: 68px;
  background: rgba(253,243,252,.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: inline-flex; }
@media (min-width: 1024px) { .topbar .brand { display: none; } }
.topbar-title { display: none; font-family: var(--font-display); font-size: 1.25rem; color: var(--ruby-950); margin: 0; }
@media (min-width: 1024px) { .topbar-title { display: block; } }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--ruby-800); cursor: pointer; text-decoration: none;
}
.icon-btn svg.i { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--ruby-500); border: 2px solid #fff; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--rose-400), var(--ruby-700)); color: #fff; font-weight: 700; font-size: .9rem;
  text-decoration: none; border: 2px solid #fff; box-shadow: var(--shadow-sm);
}
.avatar.lg { width: 84px; height: 84px; font-size: 1.6rem; border-width: 4px; }
.avatar.md { width: 56px; height: 56px; font-size: 1.1rem; }

/* Main */
.app-main { min-width: 0; }
.app-content { padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem) var(--gutter) 3rem; max-width: 1180px; margin-inline: auto; }
.app-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.app-head h1 { font-size: var(--fs-2xl); margin: 0 0 .25rem; }
.app-head p { margin: 0; color: var(--muted); }

/* Panels */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.15rem, 1rem + .8vw, 1.6rem); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2, .panel-head h3 { font-size: 1.2rem; margin: 0; }
.panel-head a { font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }

.dash-grid { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1.6fr 1fr; } }
.stack { display: grid; gap: 1.25rem; align-content: start; }

/* Welcome / member card */
.welcome {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: linear-gradient(135deg, var(--ruby-700), var(--ruby-950)); color: #fbe6f8;
  display: grid; gap: 1.5rem;
}
@media (min-width: 760px) { .welcome { grid-template-columns: 1fr auto; align-items: center; } }
.welcome h1 { color: #fff; font-size: var(--fs-2xl); margin-bottom: .35rem; }
.welcome p { color: #f3d6ef; margin: 0; }
.welcome::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 240px; height: 240px; background: url("../img/gem.svg") center / contain no-repeat; opacity: .12; pointer-events: none; }

.member-card {
  position: relative; z-index: 1; width: 100%; max-width: 320px; aspect-ratio: 1.6; border-radius: 18px; padding: 1.1rem 1.25rem;
  background: linear-gradient(135deg, #ead2a0, #c9973f 45%, #a87a2a); color: var(--ruby-950);
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 18px 40px rgba(0,0,0,.3);
}
.member-card .mc-top { display: flex; justify-content: space-between; align-items: center; font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.member-card img { width: 30px; }
.member-card .mc-name { font-family: var(--font-display); font-size: 1.35rem; line-height: 1.1; }
.member-card .mc-meta { display: flex; justify-content: space-between; font-size: .72rem; font-weight: 600; opacity: .85; }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a {
  display: flex; flex-direction: column; gap: .65rem; padding: 1.1rem; border-radius: var(--radius); background: #fff;
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: var(--fs-sm);
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.quick a:hover { transform: translateY(-3px); border-color: var(--rose-300); box-shadow: var(--shadow); color: var(--ink); }
.quick .icon-bubble { margin: 0; width: 44px; height: 44px; border-radius: 13px; }
.quick small { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }

/* Perk progress */
.perk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.perk-item { display: flex; align-items: center; gap: .85rem; padding: .85rem; border-radius: 14px; background: var(--rose-50); }
.perk-item .icon-bubble { margin: 0; width: 42px; height: 42px; border-radius: 12px; background: #fff; }
.perk-item .icon-bubble svg { width: 20px; height: 20px; }
.perk-item div { flex: 1; min-width: 0; }
.perk-item strong { display: block; font-size: var(--fs-sm); }
.perk-item span { font-size: var(--fs-xs); color: var(--muted); }
.status { font-size: .7rem; font-weight: 700; padding: .3rem .6rem; border-radius: var(--radius-pill); white-space: nowrap; }
.status.ready { background: #f7ecd6; color: var(--gold-600); }
.status.done { background: #e9f6ee; color: #1d5b36; }
.status.open { background: var(--rose-100); color: var(--ruby-700); }

.progress { height: 10px; border-radius: 999px; background: var(--rose-100); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--rose-400), var(--ruby-600)); transition: width .6s var(--ease); }

/* Event rows */
.event-row { display: flex; gap: 1rem; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.date-chip { flex: none; width: 58px; text-align: center; border-radius: 14px; background: var(--rose-100); padding: .5rem 0; line-height: 1.1; }
.date-chip b { display: block; font-family: var(--font-display); font-size: 1.4rem; color: var(--ruby-800); font-weight: 500; }
.date-chip small { font-size: .65rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ruby-600); }
.event-row .ev-body { flex: 1; min-width: 0; }
.event-row strong { display: block; font-size: var(--fs-sm); }
.event-row span { font-size: var(--fs-xs); color: var(--muted); }

.event-card { display: grid; gap: 1rem; padding: 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
@media (min-width: 700px) { .event-card { grid-template-columns: auto 1fr auto; align-items: center; } }
.event-card .date-chip { width: 72px; padding: .7rem 0; }
.event-card h3 { font-size: 1.15rem; margin: .35rem 0 .25rem; }
.event-card p { font-size: var(--fs-sm); color: var(--muted); margin: 0; }
.event-card .btn[aria-pressed="true"] { --b-bg: #e9f6ee; --b-fg: #1d5b36; --b-bd: #bfe3cc; }

/* Resource tiles */
.resource { display: flex; flex-direction: column; gap: .6rem; padding: 1.25rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); transition: transform .2s var(--ease), box-shadow .2s; }
.resource:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.resource .icon-bubble { margin: 0 0 .25rem; }
.resource h3 { font-size: 1.05rem; margin: 0; font-family: var(--font-body); font-weight: 700; color: var(--ink); letter-spacing: 0; }
.resource p { font-size: var(--fs-xs); color: var(--muted); margin: 0; }
.resource-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: auto; padding-top: .5rem; font-size: var(--fs-xs); color: var(--muted); }

.searchbar { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.searchbar svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.searchbar .input { padding-left: 2.6rem; border-radius: var(--radius-pill); }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.toolbar .chips { margin: 0; flex: 1 1 100%; }
@media (min-width: 900px) { .toolbar .chips { flex: 1 1 auto; } }

/* Directory */
.person { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; padding: 1.5rem 1.15rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.person h3 { font-size: 1.1rem; margin: .5rem 0 0; }
.person .role { font-size: var(--fs-xs); color: var(--muted); }
.person .loc { font-size: var(--fs-xs); color: var(--ruby-600); font-weight: 600; }
.person .btn-row { justify-content: center; margin-top: .6rem; }

/* Perk detail cards */
.perk-card { display: flex; flex-direction: column; gap: .75rem; }
.perk-card .perk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.perk-card .icon-bubble { margin: 0; }
.perk-card h3 { margin: 0; }
.perk-card p { font-size: var(--fs-sm); color: var(--muted); margin: 0; }
.perk-card .btn-row { margin-top: auto; padding-top: .5rem; }

.code-box { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .7rem .7rem 1rem; border: 1.5px dashed var(--gold-500); border-radius: 14px; background: #fffaf0; }
.code-box code { font-weight: 700; letter-spacing: .12em; color: var(--ruby-900); font-size: 1rem; }

/* Tabs (profile) */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; background: none; border: 0; padding: .85rem 1rem; font-weight: 600; font-size: var(--fs-sm); color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; min-height: 48px; }
.tabs button[aria-selected="true"] { color: var(--ruby-700); border-bottom-color: var(--ruby-700); }
.tab-panel[hidden] { display: none; }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row strong { display: block; font-size: var(--fs-sm); }
.toggle-row span { font-size: var(--fs-xs); color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--ruby-600); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold-500); outline-offset: 2px; }

/* Bottom tab bar (mobile) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom));
}
@media (min-width: 1024px) { .tabbar { display: none; } }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .45rem 0; min-height: 56px; justify-content: center; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 600; border-radius: 12px; }
.tabbar svg.i { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--ruby-700); }
.tabbar a[aria-current="page"] svg.i { stroke-width: 2.2; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 200;
  background: var(--ruby-950); color: #fff; padding: .8rem 1.2rem; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: 500;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); max-width: calc(100% - 2rem); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1024px) { .toast { bottom: 2rem; } }

/* Auth pages */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; }
@media (min-width: 960px) { .auth { grid-template-columns: 1fr 1fr; } }
.auth-art {
  display: none; position: relative; overflow: hidden; padding: 3rem; color: #fbe6f8;
  background: linear-gradient(150deg, var(--ruby-700), var(--ruby-950));
}
@media (min-width: 960px) { .auth-art { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-art .brand { color: #fff; }
.auth-art .brand-name small { color: var(--gold-300); }
.auth-art blockquote { font-family: var(--font-display); font-size: clamp(1.8rem, 1.2rem + 1.6vw, 2.6rem); line-height: 1.2; color: #fff; margin: 0 0 1.5rem; max-width: 18ch; }
.auth-art blockquote em { color: var(--gold-300); }
.auth-art::after { content: ""; position: absolute; right: -80px; top: 18%; width: 420px; height: 420px; background: url("../img/gem.svg") center / contain no-repeat; opacity: .12; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 2rem var(--gutter); background: var(--cream); }
.auth-form .inner { width: 100%; max-width: 440px; margin-inline: auto; }
.auth-form .brand { margin-bottom: 2.5rem; }
@media (min-width: 960px) { .auth-form .brand { display: none; } }
.auth-form h1 { font-size: var(--fs-2xl); }
.divider { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: var(--fs-xs); margin: 1.25rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.plan-pick { display: grid; gap: .75rem; }
.plan-opt { position: relative; display: flex; gap: .9rem; align-items: flex-start; padding: 1rem 1.1rem; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.plan-opt input { width: 20px; height: 20px; accent-color: var(--ruby-700); margin-top: 3px; flex: none; }
.plan-opt:has(input:checked) { border-color: var(--ruby-600); box-shadow: 0 0 0 4px rgba(191, 3, 180, .12); }
.plan-opt strong { display: block; }
.plan-opt span { font-size: var(--fs-xs); color: var(--muted); }
.plan-opt .p { margin-left: auto; font-family: var(--font-display); font-size: 1.25rem; color: var(--ruby-800); white-space: nowrap; }

/* Small-screen refinements */
@media (max-width: 479px) {
  .perk-item { flex-wrap: wrap; }
  .perk-item .status { margin-left: calc(42px + .85rem); }
  .member-card { max-width: 260px; padding: .9rem 1rem; }
  .member-card .mc-name { font-size: 1.15rem; }
}

/* Demo notice above the login form */
.demo-note { margin: 1.25rem 0 0; padding: .85rem 1rem; border-radius: 14px; background: #fff7e6; border: 1.5px solid #f0d49a; color: #5c3d00; font-size: var(--fs-sm); line-height: 1.45; }
.demo-note strong { font-weight: 700; }
.demo-note + .form { margin-top: 1.25rem; }
