/* ──────────────────────────────────────────────────────────────────────────
 * Broken Bags — admin / customer / landing
 *
 * This file CLONES the live theme's design tokens, button styles, hero,
 * tile pattern, and panel system from `vaultlight-themev17` (Broken Bags
 * Noir) so go.brokenbags.shop and admin.brokenbags.shop look identical to
 * the WordPress site at brokenbags.shop. New dashboard-specific styles
 * (KPI cards, tier badge, mail feed) are appended at the bottom and use
 * the same visual vocabulary.
 * ────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #050505;
  --bg-elevated: rgba(10, 10, 10, 0.94);
  --panel: #0d0d0f;
  --panel-soft: #1a1a1d;
  --text: #f6f6f4;
  --muted: #d4d4d8;          /* was #c0c0c6 — bumped for AA contrast on dark bg */
  --muted-soft: #a8a8ae;     /* for tertiary copy where bright muted is too loud */
  --line: rgba(255, 255, 255, 0.12);  /* was 0.08 — clearer card boundaries */
  --line-strong: rgba(255, 255, 255, 0.22);
  --accent: #ff2a32;          /* was #d80f16 — brighter for body-on-dark legibility */
  --accent-strong: #ff5159;
  --accent-soft: rgba(255, 42, 50, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  --content-width: min(1200px, calc(100vw - 32px));
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background: #040404;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top, rgba(216, 15, 22, 0.16), transparent 24%),
    linear-gradient(180deg, #020202 0%, #080808 52%, #040404 100%);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0.01em;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The diagonal "BROKEN BAGS" tile — verbatim from the theme but at 5% so it
   reads as ambience, not noise. Was 14% — content was competing with it. */
body.brand-bg::before {
  content: "";
  position: fixed;
  inset: -60vmax;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='760' height='220' viewBox='0 0 760 220'%3E%3Cg fill='%23d80f16' fill-opacity='0.05' font-family='Arial, Helvetica, sans-serif' font-size='26' font-weight='700' letter-spacing='5'%3E%3Ctext x='-20' y='48'%3EBROKEN BAGS BROKEN BAGS BROKEN BAGS%3C/text%3E%3Ctext x='-170' y='112'%3EBROKEN BAGS BROKEN BAGS BROKEN BAGS%3C/text%3E%3Ctext x='-20' y='176'%3EBROKEN BAGS BROKEN BAGS BROKEN BAGS%3C/text%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat;
  background-position: center;
  background-size: 760px 220px;
  transform: rotate(-18deg) scale(1.08);
  transform-origin: center;
  pointer-events: none;
  z-index: 0;
}
body.brand-bg > *:not(.bb-loader) { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); text-decoration: underline; text-decoration-color: rgba(216, 15, 22, 0.5); }

img { display: block; max-width: 100%; height: auto; }
hr  { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

code, .copybox code {
  background: var(--panel-soft);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  border: 1px solid var(--line);
}

.muted { color: var(--muted); }
.small { font-size: 13px; font-weight: 500; line-height: 1.5; }
p { color: var(--text); }
p.muted, .muted p, .muted { line-height: 1.55; }

/* ── Site shell ───────────────────────────────────────────────────────── */
.site-shell { width: var(--content-width); margin: 0 auto; }

.site-header {
  padding: 12px 0 9px;
  background: linear-gradient(180deg, rgba(5, 5, 6, 0.97), rgba(5, 5, 6, 0.92));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.site-header__inner {
  display: flex; align-items: center; gap: 14px;
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
}
.site-branding { display: flex; align-items: center; gap: 12px; }
.site-logo {
  width: 36px; height: 36px;
  filter: drop-shadow(0 10px 24px rgba(216, 15, 22, 0.18));
}
.site-title {
  margin: 0;
  font-size: 0.7rem; letter-spacing: 0.34em;
  text-transform: uppercase; font-weight: 700;
}
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.site-nav a {
  color: var(--muted);                  /* was rgba(244,244,242,0.58) — too dim */
  font-size: 0.72rem;
  letter-spacing: 0.20em;               /* was 0.28em — tighter for legibility */
  text-transform: uppercase;
  font-weight: 700;
  transition: color 160ms ease;
}
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav .who { color: var(--muted-soft); font-size: 11px; letter-spacing: 0.14em; }

.content { width: var(--content-width); margin: 28px auto 0; padding: 0; }
.site-footer__inner {
  width: var(--content-width); margin: 60px auto 32px;
  padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.74rem;
  text-transform: uppercase; letter-spacing: 0.22em;
  text-align: center;
}

/* ── Hero (used on landing + login) ────────────────────────────────────── */
.hero { padding: 42px 0 22px; }
.hero__wrap {
  width: min(920px, calc(100vw - 32px));
  margin: 0 auto;
  display: grid; justify-items: center; text-align: center;
  padding: 24px 0 18px;
}
.bb-brand-lockup { margin-bottom: 22px; }
.bb-brand-image--hero {
  width: min(220px, 42vw);
  filter: drop-shadow(0 18px 36px rgba(216, 15, 22, 0.10));
}
.bb-brand-image--small { width: min(96px, 28vw); }
.hero__eyebrow {
  margin: 0 0 10px;
  font-size: 0.68rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--accent);
}
.hero__title {
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}
.hero__title .accent { color: var(--accent); }
.hero__text {
  max-width: 640px; margin: 14px auto 0;
  color: rgba(244, 244, 242, 0.68); font-size: 0.98rem;
}

/* ── Buttons (verbatim from theme) ────────────────────────────────────── */
.button, .button-link, button.btn,
input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px;
  border: 0; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  font-family: inherit; font-size: 0.86rem;
  cursor: pointer;
  transition: transform 180ms ease, filter 180ms ease;
  letter-spacing: 0.18em; text-transform: uppercase;
  box-shadow: 0 14px 30px rgba(216, 15, 22, 0.22);
}
.button:hover, .button-link:hover, button.btn:hover,
input[type="submit"]:hover {
  transform: translateY(-1px); filter: brightness(1.04);
  text-decoration: none; color: #fff;
}
.button.ghost {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
}
.button.ghost:hover { border-color: rgba(255, 255, 255, 0.32); filter: none; }

/* ── Panels (entry-card style) ────────────────────────────────────────── */
.entry-card, .panel {
  padding: 24px;
  background: rgba(13, 13, 15, 0.97);   /* was 0.92 — watermark was bleeding through */
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

h1, h2, h3 { font-weight: 800; }
h1 {
  margin: 0 0 18px;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  line-height: 1; text-transform: uppercase;
  letter-spacing: -0.02em;
  color: var(--text);
}
h2 {
  margin: 32px 0 14px;
  font-size: 0.86rem;        /* was 0.78 — too small to read at 0.24em tracking */
  letter-spacing: 0.16em;    /* was 0.24em — too sparse hurt scanning */
  text-transform: uppercase;
  color: var(--text);        /* was 78% alpha — full strength now */
  font-weight: 800;
}
h3 { color: var(--text); font-size: 1rem; }
.kicker {
  font-size: 0.72rem; color: var(--muted);
  font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.18em;
  margin: 0 0 8px;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table {
  width: 100%; border-collapse: collapse;
  background: rgba(13, 13, 15, 0.97);   /* was 0.92 */
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--text);
}
.table th {
  font-weight: 800; color: var(--text); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.14em;   /* was 0.22 */
  background: rgba(0, 0, 0, 0.45);
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(255, 255, 255, 0.04); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .muted, .table td.muted { color: var(--muted); }

/* ── Pills (status / tag) ─────────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 4px 11px; border-radius: 999px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;   /* was 0.18 — tighter reads cleaner */
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.pill.good { color: #7eea9a; border-color: rgba(110,224,141,0.5); background: rgba(110,224,141,0.08); }
.pill.warn { color: #fbcd76; border-color: rgba(247,196,102,0.5); background: rgba(247,196,102,0.08); }
.pill.bad  { color: #ff8a8a; border-color: rgba(255,118,118,0.5); background: rgba(255,118,118,0.08); }
.pill.red  { color: var(--accent-strong); border-color: rgba(255,42,50,0.55); background: rgba(255,42,50,0.10); }

/* ── KPI cards ────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 0 0 28px;
}
.kpi {
  padding: 20px 22px;
  background: rgba(13, 13, 15, 0.97);   /* was 0.92 — solid against watermark */
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.kpi .label {
  color: var(--muted); font-size: 11px;
  font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;   /* was 0.22 */
}
.kpi .value {
  font-size: 1.95rem; font-weight: 900; margin-top: 8px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.kpi .delta { font-size: 13px; font-weight: 600; margin-top: 6px; color: var(--muted-soft); }
.kpi .delta.pos { color: #6ee07b; }
.kpi.accent { border-color: rgba(255, 42, 50, 0.55); box-shadow: 0 14px 30px rgba(255, 42, 50, 0.18); }
.kpi.accent .value { color: var(--accent); }

/* ── Tier badge ───────────────────────────────────────────────────────── */
.tier-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  font-size: 0.66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.22em;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  color: var(--text);
}
.tier-badge.t-Member   { color: #b8b8c0; }
.tier-badge.t-Bronze   { color: #c47a4a; border-color: rgba(196,122,74,0.35); }
.tier-badge.t-Silver   { color: #c4c4cc; border-color: rgba(196,196,204,0.35); }
.tier-badge.t-Gold     { color: #f0c060; border-color: rgba(240,192,96,0.45); }
.tier-badge.t-Platinum { color: #d6e6f0; border-color: rgba(214,230,240,0.45); }
.tier-badge.t-Diamond  { color: #fff; border-color: var(--accent);
                         background: linear-gradient(180deg, rgba(216,15,22,0.18), rgba(11,11,12,0.92)); }

/* ── Welcome / countdown bar ──────────────────────────────────────────── */
.welcome-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(216,15,22,0.20), rgba(216,15,22,0.04));
  border: 1px solid rgba(216,15,22,0.45);
  border-radius: var(--radius-md);
  margin-bottom: 22px;
}
.welcome-bar .gift { font-size: 22px; }
.welcome-bar b { color: var(--accent); }
.welcome-bar .countdown {
  margin-left: auto; font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.7rem; letter-spacing: 0.20em; text-transform: uppercase;
}

/* ── Progress bar ─────────────────────────────────────────────────────── */
.progress {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 12px; overflow: hidden;
}
.progress > .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.4s ease;
}
.progress-row {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin: 12px 0 8px;
}

/* ── /me hero (greeting + tier badge) ─────────────────────────────────── */
.me-hero {
  padding: 22px 24px;
  background: rgba(11, 11, 12, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
}
.me-hero .greeting {
  font-size: 1.7rem; font-weight: 800; line-height: 1;
  letter-spacing: -0.02em; text-transform: uppercase;
}

/* ── Copy box (referral link, magic links, etc.) ──────────────────────── */
.copybox {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sm);
  margin: 12px 0;
}
.copybox code {
  background: transparent; padding: 0; flex: 1; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copybox button {
  min-height: auto; padding: 8px 14px;
  font-size: 0.66rem; letter-spacing: 0.18em;
}

/* ── Mail feed (status + credit events) ───────────────────────────────── */
.mail {
  background: rgba(11, 11, 12, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.mail .row {
  display: flex; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 500;
}
.mail .row:last-child { border-bottom: 0; }
.mail .icon { font-size: 18px; line-height: 1.2; }
.mail .body { flex: 1; }
.mail .body .when {
  color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase; margin-top: 4px;
}

/* ── Trust counters strip (used on /go landing) ───────────────────────── */
.trust {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  max-width: 720px; margin: 36px auto 0;
}
.trust > div {
  flex: 1 1 140px; min-width: 130px;
  padding: 16px 18px; text-align: center;
  background: rgba(11, 11, 12, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}
.trust b { display: block; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.trust span {
  display: block; margin-top: 4px;
  color: var(--muted); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.22em;
}

/* ── Recent-orders ticker ─────────────────────────────────────────────── */
.ticker {
  max-width: 720px; margin: 26px auto 0;
  padding: 18px 22px;
  background: rgba(11, 11, 12, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
}
.ticker .kicker { color: var(--accent); }
.ticker .row {
  display: flex; align-items: baseline;
  gap: 28px;
  padding: 11px 0; font-size: 14px;
  border-top: 1px solid var(--line);
}
.ticker .row:first-of-type { border-top: 0; }
.ticker .row .who {
  color: var(--text);
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticker .row .when {
  color: var(--muted); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase;
  flex: 0 0 auto; white-space: nowrap;
  margin-left: auto;
}

/* ── Auth card (login / login-denied) ─────────────────────────────────── */
.auth-card {
  width: min(560px, 100%);
  margin: 60px auto 0;
  padding: 36px 40px;
  background: linear-gradient(180deg, rgba(10,10,10,0.96), rgba(8,8,8,0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 60px rgba(0,0,0,0.45);
  text-align: center;
}
.auth-card h1 {
  margin: 0 0 8px;
  font-size: 1.2rem; line-height: 1.1;
  text-transform: none; letter-spacing: 0;
}
.auth-card p { max-width: 42ch; margin: 0 auto 18px; color: var(--muted); }
.auth-card .button { margin-top: 6px; }

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .site-header__inner { flex-wrap: wrap; }
  .site-nav a:not(.who):not(.logout) { display: none; }
}
@media (max-width: 560px) {
  :root { --content-width: min(100vw - 24px, 100%); }
  .hero { padding-top: 24px; }
  .hero__wrap { padding: 16px 0 6px; }
  .auth-card { padding: 28px 22px; }
}

/* ── Animations & micro-interactions ─────────────────────────────────── */

@keyframes bb-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bb-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bb-pulse-warn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 165, 36, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(245, 165, 36, 0); }
}

@keyframes bb-pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(216, 15, 22, 0.55); }
  60%      { box-shadow: 0 0 0 8px rgba(216, 15, 22, 0); }
}

@keyframes bb-shimmer-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}

@keyframes bb-progress-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Hero / auth cards: subtle fade-up on load */
.hero__wrap > *,
.auth-card > *,
.go-hero > *,
.me-hero { animation: bb-fade-up 540ms cubic-bezier(.2,.7,.2,1) both; }
.hero__wrap > *:nth-child(1) { animation-delay: 0ms; }
.hero__wrap > *:nth-child(2) { animation-delay: 80ms; }
.hero__wrap > *:nth-child(3) { animation-delay: 160ms; }
.hero__wrap > *:nth-child(4) { animation-delay: 240ms; }
.hero__wrap > *:nth-child(5) { animation-delay: 320ms; }
.hero__wrap > *:nth-child(n+6) { animation-delay: 400ms; }

/* KPI cards: stagger on entrance */
.kpi-row .kpi { animation: bb-fade-up 480ms cubic-bezier(.2,.7,.2,1) both; }
.kpi-row .kpi:nth-child(1) { animation-delay:  20ms; }
.kpi-row .kpi:nth-child(2) { animation-delay:  90ms; }
.kpi-row .kpi:nth-child(3) { animation-delay: 160ms; }
.kpi-row .kpi:nth-child(4) { animation-delay: 230ms; }
.kpi-row .kpi:nth-child(5) { animation-delay: 300ms; }
.kpi-row .kpi:nth-child(6) { animation-delay: 370ms; }

/* Trust counters strip */
.trust > div { animation: bb-fade-up 520ms cubic-bezier(.2,.7,.2,1) both; }
.trust > div:nth-child(1) { animation-delay: 320ms; }
.trust > div:nth-child(2) { animation-delay: 380ms; }
.trust > div:nth-child(3) { animation-delay: 440ms; }
.trust > div:nth-child(4) { animation-delay: 500ms; }

/* Live-orders ticker rows */
.ticker .row { animation: bb-fade-up 360ms cubic-bezier(.2,.7,.2,1) both; }
.ticker .row:nth-child(1) { animation-delay: 540ms; }
.ticker .row:nth-child(2) { animation-delay: 600ms; }
.ticker .row:nth-child(3) { animation-delay: 660ms; }
.ticker .row:nth-child(4) { animation-delay: 720ms; }
.ticker .kicker::before {
  content: "";
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent);
  margin-right: 6px; vertical-align: 2px;
  animation: bb-shimmer-dot 1.4s ease-in-out infinite;
}

/* Mail rows: stagger fade-in */
.mail .row { animation: bb-fade-up 360ms cubic-bezier(.2,.7,.2,1) both; }
.mail .row:nth-child(1) { animation-delay:  0ms; }
.mail .row:nth-child(2) { animation-delay: 60ms; }
.mail .row:nth-child(3) { animation-delay: 120ms; }
.mail .row:nth-child(4) { animation-delay: 180ms; }
.mail .row:nth-child(5) { animation-delay: 240ms; }

/* Status pills: pulsing accent for in-flight statuses */
.pill.warn { animation: bb-pulse-warn 2.4s ease-in-out infinite; }

/* Welcome credit bar: gentle attention pulse */
.welcome-bar { animation: bb-fade-up 480ms cubic-bezier(.2,.7,.2,1) both,
                          bb-pulse-red 3.2s ease-in-out 1.2s infinite; }

/* Progress bar fill — animate from left edge */
.progress > .fill {
  transform-origin: left center;
  animation: bb-progress-fill 900ms cubic-bezier(.2,.7,.2,1) 200ms both;
}

/* Buttons: smoother lift + red glow on hover */
.button, .button-link, button.btn, input[type="submit"] {
  transition: transform 180ms cubic-bezier(.2,.7,.2,1),
              filter 180ms ease,
              box-shadow 240ms ease;
}
.button:hover, .button-link:hover, button.btn:hover, input[type="submit"]:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 18px 38px rgba(216, 15, 22, 0.30),
              0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.button:active { transform: translateY(0); }

/* Topbar logo: subtle glow on hover */
.site-branding:hover .site-logo {
  filter: drop-shadow(0 12px 28px rgba(216, 15, 22, 0.32));
  transition: filter 240ms ease;
}

/* Media tiles: smoother hover lift (already had basic) */
.media-tile img {
  transition: transform 260ms cubic-bezier(.2,.7,.2,1),
              box-shadow 260ms ease,
              border-color 260ms ease !important;
}

/* Page-level fade-in to soften route transitions */
main.content { animation: bb-fade-in 280ms ease-out both; }

/* Reduced-motion users get no movement, just opacity-snap */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .pill.warn, .welcome-bar { animation: none !important; }
}

/* ──────────────────────────────────────────────────────────────────────────
 * Mobile polish — small screens (≤640px). Keep desktop unchanged.
 * Goal: nothing horizontal-scrolls, tap targets are thumb-friendly,
 * dense tables fall back to a stacked card layout when they'd overflow.
 * ────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --content-width: calc(100vw - 24px); }
  .content   { padding: 0; margin-top: 16px; }
  h1         { font-size: clamp(1.4rem, 6vw, 1.8rem); }
  h2         { font-size: 0.8rem; letter-spacing: 0.12em; margin: 22px 0 10px; }

  /* Site header — thinner; branding + sign-out share row 1, nav wraps to row 2 */
  .site-header { padding: 4px 0; }
  .site-header__inner {
    position: relative;                /* anchor for the absolute sign-out */
    flex-wrap: wrap;
    width: calc(100vw - 24px);
    gap: 4px 14px;
    padding: 0;
    padding-right: 78px;               /* keep branding text clear of sign-out */
  }
  .site-nav {
    margin-left: 0;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
  }
  .site-nav a {
    display: inline-block;             /* override the 800px rule that hides nav links */
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    padding: 4px 0;
  }
  .site-nav .who { display: none; }    /* save space; user knows who they are */
  .site-nav .logout {                  /* hangs at the right, level with the logo */
    position: absolute;
    top: 0;
    right: 0;
    height: 36px;                      /* matches .site-logo height for vertical alignment */
    display: flex;
    align-items: center;
    padding: 0;
  }
  .site-title    { font-size: 0.62rem; letter-spacing: 0.24em; }

  /* KPI grid: 2 columns minimum, but allow phones to drop to single column */
  .kpi-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .kpi     { padding: 16px 16px; }
  .kpi .value { font-size: 1.55rem; }
  .kpi .label { font-size: 10px; letter-spacing: 0.12em; }

  /* Card padding tightens up — was eating 1/4 of the viewport */
  .entry-card, .panel { padding: 18px 16px; border-radius: 16px; }

  /* Tables that would overflow get a horizontal scroll wrapper instead of
     breaking out of the page. Wrap any .table in a div.table-wrap on
     templates that need it, or rely on the fallback below. */
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .table th, .table td {
    padding: 10px 12px;
    font-size: 13px;
  }
  .table th {
    font-size: 10px;
    letter-spacing: 0.10em;
  }

  /* Make every clickable button at least 44px tall for finger taps */
  .button { padding: 12px 20px; min-height: 44px; font-size: 13px; }

  /* The /me hero — name + tier pill stack on small screens */
  .me-hero { flex-direction: column; align-items: flex-start; gap: 10px; }
  .me-hero .tier-badge { margin-left: 0; }

  /* Welcome credit bar wraps */
  .welcome-bar { flex-wrap: wrap; gap: 8px 14px; padding: 14px 16px; }
  .welcome-bar .countdown { margin-left: 0; font-size: 12px; }

  /* Copy box: input stretches, buttons drop below */
  .copybox { flex-wrap: wrap; gap: 8px; }
  .copybox code  { flex-basis: 100%; min-width: 0; word-break: break-all; }
  .copybox button { flex: 1; }

  /* /me KPI row: tighter 2-col grid + smaller card padding */
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
  .kpi { padding: 12px 12px; }
  .kpi .label { font-size: 9px; letter-spacing: 0.10em; }
  .kpi .value { font-size: 1.3rem; }
  .kpi .delta { font-size: 11px; }

  /* /me Refer & Earn focal card — less padding, smaller halo */
  .me-earn-card { padding: 18px 16px; margin: 16px 0 22px; }
  .me-earn-card__headline { font-size: 1.25rem; }
  .me-earn-card__body { font-size: 13px; margin-bottom: 12px; }

  /* /me mail feed — tighter rows */
  .mail .row { gap: 10px; padding: 10px 0; }
  .mail .icon { font-size: 18px; }
  .mail .body { font-size: 13px; }
  .mail .when { font-size: 10px; margin-top: 3px; }

  /* /me order history table — already wraps via .table block, but
     tighten cells a notch further for small screens */
  .table th { padding: 8px 10px; font-size: 10px; }
  .table td { padding: 8px 10px; font-size: 12px; }
  .pill { font-size: 9px; padding: 3px 8px; }

  /* Quick links button row — wrap cleanly */
  main .content p a.cta { display: block; margin-bottom: 8px; text-align: center; }

  /* Site footer */
  .site-footer__inner { font-size: 10px; padding: 16px 0; }
}

/* Even smaller — narrow phones. Tightens further. */
@media (max-width: 380px) {
  .kpi-row     { grid-template-columns: 1fr; }
  .button      { padding: 11px 16px; font-size: 12px; }
  .site-nav a  { font-size: 0.60rem; letter-spacing: 0.12em; }
  h1           { font-size: 1.3rem; }
}
