/* ============================================================
 * L0CKED — design system
 * Dark, ivory-on-near-black, gold-accented, serif display.
 * Built for a premium members' club: restrained, high-contrast,
 * generous spacing. Tokens first, then components.
 * ============================================================ */

:root {
  /* Surfaces */
  --bg:        #0b0a07;
  --bg-2:      #100e0a;
  --panel:     #181510;
  --panel-2:   #1f1b14;
  --line:      #2a2620;
  --line-2:    #38322a;
  /* Ink */
  --ink:       #f6efe2;
  --ink-2:     #d8cfbd;
  --muted:     #9a9181;
  /* Lightened from #6f6757 to meet WCAG AA (4.5:1) for the small text that
     uses it — placeholders, message timestamps, footer. */
  --faint:     #8f8676;
  /* Brand */
  --accent:    #c9a063;
  --accent-2:  #e3c074;
  --accent-ink:#1a1409;
  --good:      #5fa97a;
  --good-bg:   #14271b;
  --bad:       #d2776f;
  --bad-bg:    #2c1715;
  --warn:      #d9a55f;
  /* Form */
  --radius:    10px;
  --radius-sm: 7px;
  --radius-pill: 999px;
  --shadow:    0 1px 0 rgba(255,255,255,.02), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           ui-serif, Georgia, serif;
  --sans:  ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1100px 540px at 50% -8%, #15120c 0%, rgba(21,18,12,0) 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: .2px; font-weight: 600; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--ink); }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .82rem; }
.center { text-align: center; }

/* ---------- Header / nav ---------- */
.site-header, header {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: .8rem clamp(1rem, 4vw, 2rem);
  background: rgba(16,14,10,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--accent); font-weight: 700; letter-spacing: 3px;
  font-size: 1.05rem; text-transform: uppercase;
}
.brand:hover { color: var(--accent-2); }
nav { display: flex; gap: .35rem; align-items: center; font-size: .92rem; }
nav a, nav button.link {
  position: relative; color: var(--muted); background: none; border: 0;
  cursor: pointer; font: inherit; padding: .4rem .6rem; border-radius: var(--radius-sm);
  transition: color .12s ease, background .12s ease;
}
nav a:hover, nav button.link:hover { color: var(--ink); background: var(--panel); }
nav a.active { color: var(--ink); background: var(--panel-2); }
nav a.active::after {
  content: ""; position: absolute; left: .6rem; right: .6rem; bottom: -.82rem;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.nav-badge {
  display: inline-block; min-width: 1.15rem; padding: 0 .35rem; margin-left: .25rem;
  font-family: var(--sans); font-size: .68rem; font-weight: 700; line-height: 1.2rem;
  text-align: center; color: var(--accent-ink); background: var(--accent);
  border-radius: var(--radius-pill); vertical-align: 1px;
}

/* ---------- Layout ---------- */
main { max-width: 860px; margin: 0 auto; padding: 1.5rem clamp(.85rem, 3vw, 1.25rem) 5rem; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: .5rem 0 1.25rem; flex-wrap: wrap; }
.page-head h1, .page-head h2 { margin: 0; }
.section-label { color: var(--accent); font-family: var(--sans); font-size: .72rem; letter-spacing: 2px; text-transform: uppercase; margin: 2rem 0 .75rem; }

/* ---------- Cards / panels ---------- */
.panel, .card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
  box-shadow: var(--shadow);
}
.panel { margin: 1rem 0; }
.panel.narrow { max-width: 440px; margin: 3rem auto; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }
.stack > * + * { margin-top: 1rem; }

/* ---------- Buttons ---------- */
.btn, button, input[type=submit] {
  font: inherit; font-size: .95rem; cursor: pointer;
  padding: .6rem 1.15rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--ink);
  transition: transform .08s ease, background .12s ease, border-color .12s ease, filter .12s ease;
}
.btn:hover, button:hover { border-color: var(--accent); }
.btn:active, button:active { transform: translateY(1px); }
.btn-primary, button.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink); border-color: transparent; font-weight: 700; letter-spacing: .3px;
}
.btn-primary:hover, button.primary:hover { filter: brightness(1.06); border-color: transparent; }
.btn-danger { background: var(--bad-bg); color: #f3b6b0; border-color: #5a2b27; }
.btn-ghost, button.link {
  background: transparent; border-color: transparent; color: var(--muted); padding: .5rem .7rem;
}
.btn-ghost:hover, button.link:hover { color: var(--ink); border-color: transparent; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; text-align: center; }
.cta {
  display: inline-block; padding: .85rem 1.6rem; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink); font-weight: 700; letter-spacing: .3px;
}
.cta:hover { color: var(--accent-ink); filter: brightness(1.06); }

/* ---------- Forms ---------- */
label { display: block; margin: .8rem 0 .3rem; color: var(--muted); font-size: .82rem; letter-spacing: .3px; }
input, select, textarea {
  width: 100%; padding: .65rem .8rem; color: var(--ink); font: inherit; font-size: .95rem;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,160,99,.18);
}
textarea { resize: vertical; min-height: 3rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }

.filterbar {
  display: grid; grid-template-columns: 2fr 1.4fr 1fr auto; gap: .5rem;
  margin-bottom: 1.25rem;
}
.filterbar label { display: none; }

/* ---------- Avatars ---------- */
.avatar {
  --sz: 44px;
  width: var(--sz); height: var(--sz); flex: 0 0 var(--sz);
  border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center;
  font-family: var(--sans); font-weight: 700; font-size: calc(var(--sz) * .38);
  color: var(--accent-ink); letter-spacing: .5px;
  background: linear-gradient(150deg, var(--accent-2), #9c7637);
  border: 1px solid rgba(255,255,255,.12);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { --sz: 34px; }
.avatar.lg { --sz: 60px; }
.avatar.xl { --sz: 96px; }

/* ---------- Account / "Me" page ---------- */
.account-hero { text-align: center; }
.account-hero .avatar { margin: 0 auto .75rem; }
.account-hero h2 { margin: 0; }
.account-hero .sub { color: var(--muted); margin: .2rem 0 0; }
.account-hero .hero-tier { margin-top: .6rem; display: flex; gap: .5rem;
  align-items: center; justify-content: center; }
.facts .rowflex { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.facts .rowflex:last-child { border-bottom: 0; }
.avatar-row { align-items: center; gap: 1rem; }

/* ---------- Tier badge ---------- */
.tier-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--sans); font-size: .68rem; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; padding: .18rem .5rem; border-radius: var(--radius-pill);
  border: 1px solid currentColor; line-height: 1.1;
}
.tier-badge .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }

/* ---------- Member / list rows ---------- */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.member-card { display: flex; gap: .85rem; align-items: flex-start; }
.member-card .meta { min-width: 0; flex: 1; }
.member-card h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.member-card .sub { color: var(--muted); font-size: .85rem; margin: 0 0 .5rem; overflow-wrap: anywhere; }
.member-card .row-actions { margin-top: .5rem; }
.rowflex { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Events ---------- */
.event-card .when { color: var(--accent-2); font-family: var(--sans); font-size: .82rem; letter-spacing: .3px; }
.event-card h3 { margin: .15rem 0 .35rem; }
.event-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem;
  font-family: var(--sans); font-size: .72rem; border-radius: var(--radius-pill);
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-2);
}
.chip.go { color: var(--good); border-color: #2c5a3e; background: var(--good-bg); }
.rsvp-form { display: flex; gap: .4rem; align-items: center; margin-top: .75rem; }
.rsvp-form select { width: auto; }

/* ---------- DM inbox + thread ---------- */
.convo { display: flex; gap: .85rem; align-items: center; padding: .85rem 1rem; }
.convo .meta { flex: 1; min-width: 0; }
.convo .meta h3 { margin: 0; font-size: 1rem; }
.convo .preview { color: var(--muted); font-size: .86rem; margin: .1rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .aside { text-align: right; color: var(--faint); font-size: .74rem; white-space: nowrap; }
.unread-dot { display: inline-block; min-width: 1.25rem; padding: 0 .4rem; margin-top: .25rem; font-family: var(--sans); font-size: .7rem; font-weight: 700; line-height: 1.25rem; color: var(--accent-ink); background: var(--accent); border-radius: var(--radius-pill); }

.thread { display: flex; flex-direction: column; gap: .45rem; margin: 1rem 0; }
.bubble { max-width: 78%; padding: .55rem .85rem; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.bubble p { margin: 0; overflow-wrap: anywhere; }
.bubble time { display: block; margin-top: .25rem; color: var(--faint); font-family: var(--sans); font-size: .68rem; }
.bubble.mine { align-self: flex-end; background: linear-gradient(180deg, #2e2718, #271f12); border-color: #3a2f1b; }
.bubble.theirs { align-self: flex-start; }
.composer { display: flex; flex-direction: column; gap: .5rem; }
.load-older { text-align: center; margin: .25rem 0 .5rem; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 1.5rem 0 .5rem; font-family: var(--sans); font-size: .85rem; }
.pager a, .pager span {
  min-width: 2.1rem; padding: .4rem .65rem; text-align: center; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); color: var(--ink-2); background: var(--panel);
}
.pager a:hover { border-color: var(--accent); color: var(--ink); }
.pager .current { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.pager .disabled { opacity: .4; pointer-events: none; }
.pager .count { border: 0; background: none; color: var(--muted); }

/* ---------- Hero / landing ---------- */
.hero { text-align: center; padding: clamp(3rem, 9vw, 6rem) 1rem 2.5rem; }
.hero .eyebrow { color: var(--accent); font-family: var(--sans); letter-spacing: 3px; text-transform: uppercase; font-size: .76rem; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); margin: .6rem 0 .4rem; }
.hero p { color: var(--ink-2); max-width: 36rem; margin: .5rem auto 1.6rem; font-size: 1.08rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; margin-top: 2.5rem; text-align: left; }
.feature { padding: 1.1rem 1.2rem; }
.feature h3 { margin: .1rem 0 .35rem; font-size: 1.05rem; }
.feature p { color: var(--muted); font-size: .9rem; margin: 0; }
.feature .mark { color: var(--accent); font-size: 1.3rem; }

/* ---------- Status / flashes / empty ---------- */
.flash, .notice {
  padding: .7rem .9rem; border-radius: var(--radius-sm); margin: .6rem 0;
  border-left: 4px solid currentColor; font-size: .92rem;
}
.flash.error { background: var(--bad-bg); color: #f0b4ae; }
.flash.info, .flash.success { background: var(--good-bg); color: #bce4c4; }
.status { font-family: var(--sans); font-size: .82rem; font-weight: 700; letter-spacing: .4px; text-transform: capitalize; }
.status.approved { color: var(--good); }
.status.rejected { color: var(--bad); }
.status.applied, .status.none, .status.paused { color: var(--warn); }
.empty-state, .empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state h3 { margin: 0 0 .4rem; color: var(--ink); font-weight: 600; }
.empty-state p { margin: 0 auto; max-width: 360px; }

/* ---------- Footer ---------- */
.ahd-footer { text-align: center; padding: 2rem 1rem; color: var(--faint); font-family: var(--sans); font-size: .78rem; border-top: 1px solid var(--line); }
.ahd-footer a { color: var(--muted); }

/* ---------- A11y, loading, motion ---------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm);
}
.skip-link { position: absolute; top: -100px; left: 0; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 100; border-radius: 0 0 var(--radius-sm) 0; }
.skip-link:focus { top: 0; }
[aria-busy="true"] { cursor: progress; opacity: .75; pointer-events: none; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: .4rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.card, .panel, .btn, button, nav a { transition-property: transform, box-shadow, background, border-color, color, filter; }
a.cardlink:hover { transform: translateY(-1px); }

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  main { padding: 1rem .8rem 3.5rem; }
  nav { gap: .15rem; flex-wrap: wrap; font-size: .86rem; }
  .filterbar { grid-template-columns: 1fr 1fr; }
  .filterbar .full, .filterbar button { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .member-grid { grid-template-columns: 1fr; }
  button.primary, .cta, .btn-block { width: 100%; text-align: center; }
  .page-head { gap: .25rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================================================
 * Auth / onboarding polish (QuitMe-parity, L0CKED palette)
 * ============================================================ */

/* ---------- Branded sign-in ---------- */
.auth-card { max-width: 420px; margin-top: 2.5rem; }
.auth-card .eyebrow {
  color: var(--accent); font-family: var(--sans); letter-spacing: 3px;
  text-transform: uppercase; font-size: .72rem;
}
.auth-card h1 { font-size: clamp(1.6rem, 4vw, 2rem); margin: .4rem 0 .3rem; }
.auth-card h2 { margin: .2rem 0; }
.auth-card .check {
  font-size: 2.4rem; color: var(--accent); line-height: 1;
}
.auth-card label:first-of-type { margin-top: 1rem; }

/* ---------- Onboarding stepper ---------- */
.stepper {
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 1.5rem; font-family: var(--sans); flex-wrap: wrap;
}
.stepper .step {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--faint); font-size: .8rem; letter-spacing: .3px;
}
.stepper .num {
  width: 1.65rem; height: 1.65rem; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-2); font-size: .8rem; font-weight: 700;
}
.stepper .step.on { color: var(--ink); }
.stepper .step.on .num { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.stepper .step.done { color: var(--ink-2); }
.stepper .step.done .num { background: var(--good-bg); color: var(--good); border-color: #2c5a3e; }
.stepper .bar { flex: 1; height: 1px; background: var(--line); min-width: .75rem; }

/* ---------- Compact progress dots (mobile onboarding parity) ---------- */
.onb-progress { display: flex; gap: 6px; margin: 0 0 1.25rem; }
.onb-progress .dot { width: 30px; height: 4px; border-radius: 999px; background: var(--line-2); }
.onb-progress .dot.on { background: var(--accent); }

/* ---------- Status timeline ---------- */
.timeline { list-style: none; margin: .25rem 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.15rem 1.7rem; color: var(--muted); font-size: .92rem; }
.timeline li::before {
  content: ""; position: absolute; left: .3rem; top: .3rem;
  width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--line-2); border: 2px solid var(--panel);
}
.timeline li::after {
  content: ""; position: absolute; left: .56rem; top: .95rem; bottom: -.15rem;
  width: 1px; background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--ink-2); }
.timeline li.done::before { background: var(--good); }
.timeline li.on::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(201,160,99,.18); }
.timeline li strong { color: var(--ink); display: block; font-weight: 600; margin-bottom: .1rem; }

/* ============================================================
 * The Floor — members' social feed
 * ============================================================ */
.compose textarea { min-height: 3.5rem; }
.kind-pick { display: inline-flex; align-items: center; gap: .35rem; margin: 0; color: var(--muted);
  font-size: .85rem; cursor: pointer; padding: .3rem .65rem; border: 1px solid var(--line-2); border-radius: var(--radius-pill); }
.kind-pick input { width: auto; margin: 0; }
.photo-btn { cursor: pointer; }
.post { margin: 1rem 0; }
.post-head { display: flex; align-items: flex-start; gap: .75rem; }
.post-head .meta { flex: 1; min-width: 0; }
.post-head h3 { margin: 0; font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.post-head .sub { color: var(--muted); font-size: .82rem; margin: .1rem 0 0; }
.chip.q { background: rgba(201,160,99,.15); color: var(--accent-2); border: 1px solid var(--line-2);
  font-family: var(--sans); font-size: .64rem; letter-spacing: .5px; text-transform: uppercase; padding: .1rem .45rem; border-radius: var(--radius-pill); }
.post-body { margin: .75rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin: .5rem 0; }
.post-photos img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.reactions { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; padding: .55rem 0 .25rem; border-top: 1px solid var(--line); margin-top: .5rem; }
.react-form { margin: 0; }
.react { display: inline-flex; align-items: center; gap: .3rem; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-pill); padding: .25rem .6rem; font-size: .9rem; color: var(--muted); }
.react:hover { border-color: var(--accent); color: var(--ink); }
.react.on { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.react .rlabel { font-family: var(--sans); font-size: .72rem; }
.react-count { margin-left: auto; color: var(--muted); font-size: .82rem; }
.comments { margin-top: .5rem; }
.comment { padding: .35rem 0; font-size: .92rem; overflow-wrap: anywhere; }
.comment strong { color: var(--ink-2); }
.comment-form { display: flex; gap: .4rem; margin-top: .4rem; }
.comment-form input { flex: 1; }
.post-menu { position: relative; }
.post-menu summary { list-style: none; cursor: pointer; color: var(--muted); padding: 0 .3rem; font-size: 1.1rem; }
.post-menu summary::-webkit-details-marker { display: none; }
.post-menu .menu { position: absolute; right: 0; top: 1.5rem; background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: .3rem; z-index: 5; min-width: 10rem; box-shadow: var(--shadow); }
.post-menu .menu form { margin: 0; }
.post-menu .menu button { width: 100%; text-align: left; }
@media (max-width: 620px) { .react .rlabel { display: none; } }
