/* countsplit.rayslight.com — built on the rayslight.com design tokens (ink, paper, the amber "ray", Bricolage
   Grotesque + Figtree), with Count Split's teal as the app color, the way rayslight.com gives each app one. */
:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-on-dark: #cbd5e1;
  --paper: #f8fafc;
  --white: #ffffff;
  --mist: #f1f5f9;
  --line: #e2e8f0;

  --ray: #f59e0b;
  --ray-light: #fbbf24;

  --app: #0f766e;
  --app-bright: #14b8a6;
  --app-soft: #ccfbf1;
  --owed: #15803d;
  --owe: #dc2626;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, sans-serif;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --max-width: 1140px;
  --nav-height: 72px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
}

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

/* `hidden` always wins, even over classes that set display */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.3rem, 5vw, 3.7rem); font-weight: 800; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }

p { margin: 0 0 1em; max-width: 65ch; }
a { color: inherit; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid var(--ray); outline-offset: 3px; border-radius: 6px; }

.container { width: min(100% - 2.5rem, var(--max-width)); margin-inline: auto; }
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section--mist { background: var(--mist); }
.section-intro { max-width: 62ch; margin-bottom: 2.5rem; }
.section-intro p { color: var(--ink-soft); font-size: 1.125rem; }

.eyebrow {
  display: inline-block;
  margin-bottom: 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--app);
}

/* Buttons, as on rayslight.com */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.55rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn--small { padding: 0.55rem 1.1rem; font-size: 0.95rem; }
.btn--ray { background: var(--ray); color: var(--ink); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35); }
.btn--ray:hover { background: var(--ray-light); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4); }
.btn--app { background: var(--app); color: var(--white); box-shadow: 0 4px 14px rgba(15, 118, 110, 0.32); }
.btn--app:hover { background: #115e59; transform: translateY(-1px); }
.btn--outline { border-color: var(--line); color: var(--ink); background: var(--white); }
.btn--outline:hover { border-color: var(--ink); background: var(--ink); color: var(--white); }
.btn--ghost { border-color: rgba(255, 255, 255, 0.35); color: var(--white); background: transparent; }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.55); }
.btn svg { flex: none; }

/* Header */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 252, 254, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.navbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: var(--nav-height); }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; text-decoration: none; }
.brand__icon { width: 38px; height: 38px; border-radius: 11px; box-shadow: var(--shadow-md); }
.brand__name { display: block; font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.brand__by { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.navbar__links { display: flex; align-items: center; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.navbar__link {
  display: inline-flex;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
}
.navbar__link:hover, .navbar__link.is-active { color: var(--ink); background: var(--mist); }
.navbar__cta { margin-left: 0.5rem; }
@media (max-width: 760px) {
  .navbar__links li:not(.navbar__cta-item) { display: none; }
  .navbar__cta { margin-left: 0; }
}

/* Hero */
.hero { position: relative; overflow: hidden; padding-block: clamp(3rem, 8vw, 6rem); }
.hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 640px;
  height: 640px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.16), transparent 62%);
  pointer-events: none;
}
.hero__grid { position: relative; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero__lead { font-size: 1.2rem; color: var(--ink-soft); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.hero__note { margin-top: 1rem; font-size: 0.92rem; color: var(--ink-soft); }
.hero__ray { color: var(--app); }
@media (max-width: 880px) { .hero__grid { grid-template-columns: 1fr; } }

/* The example "settle up" card in the hero (rayslight.com shows a small example instead of screenshots) */
.preview {
  justify-self: center;
  width: min(100%, 360px);
  padding: 1.1rem;
  border-radius: 28px;
  background: var(--white);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
  border: 1px solid var(--line);
}
.preview__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.preview__group { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; }
.preview__emoji { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--app-soft); font-size: 1.3rem; }
.preview__chip { padding: 0.25rem 0.65rem; border-radius: 999px; background: var(--mist); font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.preview__total { padding: 1rem; border-radius: 20px; background: var(--mist); text-align: center; }
.preview__label { font-size: 0.85rem; color: var(--ink-soft); }
.preview__amount { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--owed); }
.preview__row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; padding: 0.75rem; border-radius: 18px; border: 1px solid var(--line); }
.preview__avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.preview__who { flex: 1; font-size: 0.95rem; }
.preview__who b { display: block; }
.preview__who span { font-size: 0.82rem; color: var(--ink-soft); }
.preview__owed { font-weight: 700; color: var(--owed); white-space: nowrap; }
.preview__owe { font-weight: 700; color: var(--owe); white-space: nowrap; }
.preview__button { display: block; margin-top: 0.9rem; padding: 0.75rem; border-radius: 999px; background: var(--app); color: var(--white); font-weight: 600; text-align: center; }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.feature { padding: 1.5rem; border-radius: var(--radius-lg); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.feature__icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 1rem; border-radius: var(--radius-md); background: var(--app-soft); color: var(--app); }
.feature h3 { margin-bottom: 0.35rem; }
.feature p { margin: 0; color: var(--ink-soft); font-size: 1rem; }
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } }

.extras { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }
.extras span { padding: 0.45rem 0.9rem; border-radius: 999px; background: var(--white); border: 1px solid var(--line); font-size: 0.95rem; font-weight: 500; color: var(--ink-soft); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.step { position: relative; padding: 1.5rem; border-radius: var(--radius-lg); background: var(--white); border: 1px solid var(--line); }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: var(--ray);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
}
.step p { margin: 0; color: var(--ink-soft); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* Dark band, as rayslight.com's page heads */
.band { background: var(--ink); color: var(--white); }
.band p { color: var(--ink-on-dark); }
.band__grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 2rem; align-items: center; }
.band__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.band__list li { display: flex; gap: 0.7rem; align-items: flex-start; color: var(--ink-on-dark); }
.band__list svg { flex: none; margin-top: 0.2rem; color: var(--ray); }
@media (max-width: 820px) { .band__grid { grid-template-columns: 1fr; } }

/* Inner pages: dark head, then a readable document */
.page-head { background: var(--ink); color: var(--white); padding-block: clamp(3rem, 7vw, 5rem); }
.page-head h1 { margin-bottom: 0.35em; }
.page-head p { color: var(--ink-on-dark); font-size: 1.125rem; margin: 0; }
.page-head .eyebrow { color: var(--ray); }

.doc { display: grid; grid-template-columns: 240px 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.doc__toc { position: sticky; top: calc(var(--nav-height) + 1.5rem); padding: 1.25rem; border-radius: var(--radius-lg); background: var(--white); border: 1px solid var(--line); font-size: 0.95rem; }
.doc__toc strong { display: block; margin-bottom: 0.6rem; font-family: var(--font-display); }
.doc__toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.doc__toc a { color: var(--ink-soft); text-decoration: none; }
.doc__toc a:hover { color: var(--app); text-decoration: underline; }
.doc__body h2 { font-size: 1.5rem; margin-top: 2.5rem; scroll-margin-top: calc(var(--nav-height) + 1rem); }
.doc__body h2:first-child { margin-top: 0; }
.doc__body h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.doc__body p, .doc__body li { color: #334155; }
.doc__body ul { padding-left: 1.25rem; max-width: 65ch; }
.doc__body li { margin-bottom: 0.4rem; }
.doc__body a { color: var(--app); font-weight: 600; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.doc__summary { padding: 1.25rem 1.5rem; margin-bottom: 2rem; border-radius: var(--radius-lg); background: var(--app-soft); border: 1px solid rgba(15, 118, 110, 0.18); }
.doc__summary h2 { margin-top: 0 !important; font-size: 1.2rem; color: #134e4a; }
.doc__summary ul { margin: 0; }
.doc__summary li { color: #134e4a; }
.doc__meta { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: 0.95rem; color: var(--ink-soft); }
@media (max-width: 860px) {
  .doc { grid-template-columns: 1fr; }
  .doc__toc { position: static; }
}

.steps-list { counter-reset: item; list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.75rem; max-width: 65ch; }
.steps-list li { counter-increment: item; display: flex; gap: 0.85rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--radius-md); background: var(--white); border: 1px solid var(--line); }
.steps-list li::before {
  content: counter(item);
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--app);
  color: var(--white);
  font-weight: 700;
  font-size: 0.9rem;
}
.steps-list li > span { flex: 1; min-width: 0; }

/* Invite landing */
.invite { display: grid; place-items: center; min-height: calc(100vh - var(--nav-height)); padding-block: 3rem; }
.invite__card { width: min(100%, 460px); padding: 2rem; border-radius: 28px; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-lg); text-align: center; }
.invite__emoji { display: grid; place-items: center; width: 84px; height: 84px; margin: 0 auto 1.1rem; border-radius: 26px; background: var(--app-soft); font-size: 2.6rem; }
.invite__card h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); }
.invite__card p { margin-inline: auto; color: var(--ink-soft); }
.invite__actions { display: grid; gap: 0.7rem; margin-top: 1.5rem; }
.invite__hint { margin-top: 1.25rem; font-size: 0.9rem; }

/* Footer, as on rayslight.com */
.footer { background: var(--ink); color: var(--ink-on-dark); padding-top: clamp(3rem, 6vw, 4.5rem); }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem; }
.footer__brand p { margin-top: 1rem; font-size: 0.98rem; max-width: 34ch; }
.footer__heading { margin: 0 0 0.9rem; font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--white); }
.footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; font-size: 0.98rem; }
.footer__list a { text-decoration: none; }
.footer__list a:hover { color: var(--white); text-decoration: underline; }
.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; margin-top: 2.5rem; padding-block: 1.5rem; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.9rem; }
.footer__bottom p { margin: 0; }
@media (max-width: 860px) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__brand { grid-column: 1 / -1; } }

.logo { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--white); font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }

/* Group invite preview: the group, its numbers, members and recent expenses, then Join */
.invite-page { padding-block: clamp(1.5rem, 5vw, 3.5rem); background: radial-gradient(circle at 50% -10%, rgba(20, 184, 166, 0.14), transparent 55%); }
.gp { width: min(100%, 560px); margin-inline: auto; padding: clamp(1.25rem, 4vw, 2rem); border-radius: 28px; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.gp__head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.15rem; }
.gp__head .eyebrow { margin: 0.9rem 0 0.2rem; }
.gp__emoji { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 26px; background: var(--app-soft); font-size: 2.6rem; }
.gp__title { margin: 0; font-size: clamp(1.7rem, 5vw, 2.2rem); }
.gp__desc { margin: 0.4rem auto 0; color: var(--ink-soft); text-align: center; }
.gp__meta { margin: 0.45rem 0 0; font-size: 0.92rem; color: var(--ink-soft); }
.gp__stats { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 0.6rem; margin-top: 1.5rem; }
.gp__stat { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.85rem 1rem; border-radius: var(--radius-md); background: var(--mist); min-width: 0; }
.gp__stat--main { background: var(--app); color: var(--white); }
.gp__stat-label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.gp__stat--main .gp__stat-label { color: rgba(255, 255, 255, 0.82); }
.gp__stat-value { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.gp__section { margin-top: 1.6rem; }
.gp__heading { margin: 0 0 0.7rem; font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.gp__members { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.gp__member { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.75rem 0.3rem 0.3rem; border-radius: 999px; background: var(--mist); font-weight: 600; font-size: 0.95rem; max-width: 100%; }
.gp__avatar { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; color: var(--white); font-size: 0.85rem; font-weight: 700; }
.gp__member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp__chip { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--app-soft); color: var(--app); font-size: 0.75rem; font-weight: 700; }
.gp__expenses { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.gp__expense { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0.9rem; }
.gp__expense + .gp__expense { border-top: 1px solid var(--line); }
.gp__expense-emoji { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--mist); font-size: 1.25rem; }
.gp__expense-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gp__expense-title { font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: break-word; }
.gp__expense-meta { margin-top: 0.1rem; font-size: 0.85rem; line-height: 1.35; color: var(--ink-soft); }
.gp__expense-amount { flex: none; padding-top: 0.05rem; font-weight: 700; white-space: nowrap; }
.gp__empty { margin: 0; padding: 1rem; border-radius: var(--radius-lg); background: var(--mist); color: var(--ink-soft); text-align: center; max-width: none; }
.gp__approval { display: flex; align-items: center; gap: 0.55rem; margin: 1.25rem 0 0; padding: 0.75rem 0.9rem; border-radius: var(--radius-md); background: #fef3c7; color: #92400e; font-size: 0.92rem; font-weight: 500; max-width: none; }
.gp__approval svg { flex: none; }
.gp__missing { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }
.gp__actions { display: grid; gap: 0.65rem; margin-top: 1.6rem; }
.gp__hint { margin: 1rem auto 0; font-size: 0.88rem; color: var(--ink-soft); text-align: center; }
@media (max-width: 480px) {
  .invite-page .container { width: min(100% - 1.25rem, var(--max-width)); }
  .gp { padding: 1.1rem; border-radius: 24px; }
  .gp__stats { grid-template-columns: 1fr 1fr; }
  .gp__stat--main { grid-column: 1 / -1; }
  .gp__expense { gap: 0.6rem; padding: 0.7rem 0.75rem; }
  .gp__expense-emoji { width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; }
  .gp__expense-amount { font-size: 0.95rem; }
}

.skel { display: block; border-radius: 10px; background: linear-gradient(90deg, var(--mist) 25%, #e8edf3 50%, var(--mist) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skel--line { height: 14px; margin-top: 0.6rem; }
.skel--title { width: 70%; height: 30px; margin-top: 0.6rem; }
.skel--tile { height: 64px; }
.skel--block { height: 160px; margin-top: 1.6rem; }
.gp__head .gp__emoji.skel { width: 84px; height: 84px; border-radius: 26px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

.footer--slim { padding-top: 0; }
.footer--slim .footer__bottom { margin-top: 0; border-top: 0; }
.footer--slim a { color: var(--white); }

/* The invite page keeps its slim footer at the bottom of short pages */
.page-invite { display: flex; flex-direction: column; min-height: 100vh; }
.page-invite main { flex: 1; }
