/* Theme and reset */
:root {
  --g: #10b981;
  --gd: #059669;
  --bg: #0b1120;
  --card: #131c2e;
  --line: #243049;
  --t: #f1f5f9;
  --m: #8b9ab3;
  --red: #ef4444;

  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--t);
  line-height: 1.55;
}

/* Shared layout and controls */
.view {
  display: none;
}

.view.on {
  display: block;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: 0;
  border-radius: 8px;
  background: var(--g);
  color: #04130d;
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: .15s;
}

.btn:hover {
  background: #34d399;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--t);
}

.btn.ghost:hover {
  border-color: var(--g);
  color: var(--g);
}

.btn.sm {
  padding: 7px 14px;
  font-size: .82rem;
}

.btn:disabled {
  opacity: .55;
  cursor: default;
}

.btn.done {
  border: 1px solid var(--g);
  background: transparent;
  color: var(--g);
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
nav.top {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  right: 0;
  left: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 17, 32, .92);
}

nav.top .wrap {
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 2px;
}

.logo b {
  color: var(--g);
}

nav.top a.l {
  margin-right: 26px;
  color: var(--m);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}

nav.top a.l:hover {
  color: var(--t);
}

/* Landing page */
.hero {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: center;
  overflow: hidden;
  background: #0a0f1a;
}

.hero video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero .shade {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 22, .68);
}

.hero .in {
  position: relative;
  max-width: 720px;
  padding: 120px 0 80px;
}

.eyebrow {
  margin-bottom: 18px;
  color: var(--g);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -1.5px;
}

.hero p {
  max-width: 560px;
  margin: 22px 0 34px;
  color: #c3cddd;
  font-size: 1.15rem;
}

.hero .cta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero .btn {
  padding: 15px 32px;
  font-size: 1rem;
}

section.s {
  padding: 90px 0;
  border-top: 1px solid var(--line);
}

section.alt {
  background: #0e1626;
}

.h2 {
  margin-bottom: 10px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.5px;
}

.sub {
  max-width: 540px;
  margin-bottom: 44px;
  color: var(--m);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.stats div {
  padding: 28px 22px;
  background: var(--card);
}

.stats b {
  display: block;
  color: var(--g);
  font-size: 2rem;
}

.stats span {
  color: var(--m);
  font-size: .88rem;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.card h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.card p {
  color: var(--m);
  font-size: .93rem;
}

.num {
  margin-bottom: 14px;
  color: var(--g);
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: 2px;
}

.plan {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.plan.pop {
  border-color: var(--g);
}

.tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 5px;
  background: rgba(16, 185, 129, .14);
  color: var(--g);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.price {
  margin: 10px 0;
  font-size: 2.5rem;
  font-weight: 800;
}

.price small {
  color: var(--m);
  font-size: .9rem;
  font-weight: 500;
}

.plan ul {
  color: var(--m);
  font-size: .92rem;
  list-style: none;
}

.plan li {
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.plan li:before {
  color: var(--g);
  font-weight: 700;
  content: "✓ ";
}

footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  color: var(--m);
  font-size: .85rem;
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

/* Sign-up form and member states */
.center {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
}

.box {
  width: 100%;
  max-width: 460px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.box h2 {
  margin-bottom: 6px;
  font-size: 1.5rem;
}

.chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 22px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: .92rem;
}

.chosen b {
  color: var(--g);
}

.fg {
  margin-bottom: 16px;
}

.fg label {
  display: block;
  margin-bottom: 6px;
  color: var(--m);
  font-size: .82rem;
  font-weight: 600;
}

.fg input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--t);
  font-size: 1rem;
}

.fg input:focus {
  outline: 0;
  border-color: var(--g);
}

.muted-copy {
  color: var(--m);
  font-size: .92rem;
}

.form-submit,
.back-to-plans {
  width: 100%;
}

.form-submit {
  margin-top: 6px;
}

.back-to-plans {
  margin-top: 12px;
}

.centered-box {
  text-align: center;
}

.success-message {
  margin: 10px 0 26px;
  color: var(--m);
}

.success-plan {
  color: var(--t);
}

.full-width {
  width: 100%;
}

/* Loading and success indicators */
.spin {
  width: 54px;
  height: 54px;
  margin: 0 auto 26px;
  border: 4px solid var(--line);
  border-top-color: var(--g);
  border-radius: 50%;
  animation: sp 1s linear infinite;
}

@keyframes sp {
  to {
    transform: rotate(360deg);
  }
}

.steps {
  max-width: 300px;
  margin: 24px auto 0;
  color: var(--m);
  font-size: .92rem;
  list-style: none;
  text-align: left;
}

.steps li {
  padding: 7px 0;
  opacity: .35;
  transition: .3s;
}

.steps li.on {
  color: var(--t);
  opacity: 1;
}

.steps li.on:before {
  color: var(--g);
  font-weight: 700;
  content: "✓ ";
}

.bar {
  height: 4px;
  margin-top: 26px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}

.bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--g);
  transition: width 3.4s linear;
}

.tick {
  display: flex;
  width: 84px;
  height: 84px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  border: 3px solid var(--g);
  border-radius: 50%;
  color: var(--g);
  font-size: 2.4rem;
  animation: pop .5s ease;
}

@keyframes pop {
  from {
    transform: scale(.4);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Member portal */
.portal {
  display: flex;
  min-height: 100vh;
}

aside {
  position: sticky;
  top: 0;
  display: flex;
  width: 250px;
  height: 100vh;
  flex-direction: column;
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: var(--card);
}

aside .logo {
  margin: 0 8px 30px;
}

aside button.nv {
  width: 100%;
  margin-bottom: 4px;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--m);
  font-size: .93rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

aside button.nv:hover {
  color: var(--t);
}

aside button.nv.on {
  background: rgba(16, 185, 129, .14);
  color: var(--g);
}

aside .out {
  margin-top: auto;
  color: var(--red) !important;
}

.main {
  min-width: 0;
  flex: 1;
  padding: 36px;
}

.main header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.main h1 {
  font-size: 1.7rem;
}

.tab {
  display: none;
}

.tab.on {
  display: block;
}

.dgrid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.kpis .card b {
  display: block;
  font-size: 1.5rem;
}

.kpis .card span {
  color: var(--m);
  font-size: .82rem;
}

.updates-card {
  margin-bottom: 22px;
}

.updates-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.updates-heading h2 {
  font-size: 1.1rem;
}

.updates-intro,
.updates-empty {
  margin-top: 4px;
  color: var(--m);
  font-size: .85rem;
}

.updates-list {
  display: grid;
  gap: 10px;
}

.update-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--g);
  border-radius: 8px;
  background: var(--bg);
}

.update-item.gentle {
  border-left-color: #60a5fa;
}

.update-item h3 {
  margin-bottom: 4px;
  font-size: .95rem;
}

.update-item p {
  margin-bottom: 10px;
  color: var(--m);
  font-size: .88rem;
}

.update-item .btn {
  margin-top: 2px;
}

.card h3.t {
  margin-bottom: 12px;
  color: var(--g);
  font-size: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
  text-align: left;
}

th {
  color: var(--m);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.tw {
  overflow-x: auto;
}

.b {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}

.b.g {
  background: rgba(16, 185, 129, .14);
  color: var(--g);
}

.b.r {
  background: rgba(239, 68, 68, .14);
  color: var(--red);
}

.b.y {
  background: rgba(245, 158, 11, .14);
  color: #f59e0b;
}

.pass {
  text-align: center;
}

.qr {
  width: 170px;
  margin: 14px auto 10px;
  padding: 14px;
  border-radius: 10px;
  background: #fff;
}

.qr svg {
  display: block;
  width: 100%;
}

.pass-copy {
  color: var(--m);
  font-size: .85rem;
}

.member-id {
  font-family: monospace;
  font-size: .85rem;
}

.empty {
  padding: 26px 0;
  color: var(--m);
  font-size: .92rem;
  text-align: center;
}

.tr {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.av {
  display: flex;
  width: 52px;
  height: 52px;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, .14);
  color: var(--g);
  font-weight: 800;
}

.coach-specialty {
  margin: 2px 0 10px;
  color: var(--g);
  font-size: .85rem;
}

.coach-description {
  margin-bottom: 16px;
  color: var(--m);
  font-size: .92rem;
}

#toast {
  position: fixed;
  z-index: 50;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  max-width: 90vw;
  padding: 12px 22px;
  transform: translate(-50%, 30px);
  border-radius: 8px;
  background: #e8fff6;
  color: #04130d;
  font-size: .9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
}

#toast.on {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* Tablet and small desktop layout */
@media (max-width: 860px) {
  .stats,
  .grid3,
  .dgrid,
  .kpis {
    grid-template-columns: 1fr;
  }

  nav.top a.l {
    display: none;
  }

  .portal {
    flex-direction: column;
  }

  aside {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  aside .logo {
    margin: 0 10px 0 4px;
  }

  aside button.nv {
    width: auto;
    margin: 0;
    padding: 8px 12px;
  }

  aside .out {
    margin: 0 0 0 auto;
  }

  .main {
    padding: 22px 16px;
  }
}

/* Modal, QR reveal, trainer cards, and mobile layout */
[hidden] { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 8, 16, .75);
}

.mbox {
  width: 100%;
  max-width: 400px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.mbox h3 { margin-bottom: 8px; font-size: 1.2rem; }
.mbox p { margin-bottom: 22px; color: var(--m); font-size: .92rem; }
.mact { display: flex; gap: 10px; }
.mact .btn { flex: 1; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #dc2626; }

.qlock { padding: 18px 0 6px; }
.qicon {
  display: flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--g);
  font-size: 1.8rem;
}
.qbar { height: 4px; margin: 4px auto 10px; width: 170px; overflow: hidden; border-radius: 4px; background: var(--line); }
.qbar i { display: block; width: 100%; height: 100%; background: var(--g); }
.qlive .btn { margin-top: 10px; }

.buddy-intro {
  margin-top: 4px;
  color: var(--m);
  font-size: .92rem;
}

.buddy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 22px;
}

.buddy-grid h2 {
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.buddy-copy {
  color: var(--m);
  font-size: .92rem;
}

.buddy-scan-card {
  text-align: center;
}

.buddy-scan-graphic {
  margin: 24px 0;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.buddy-scan-graphic .qicon {
  width: 76px;
  height: 76px;
  margin-bottom: 10px;
}

.buddy-scan-graphic span {
  color: var(--m);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.buddy-feedback {
  min-height: 1.5em;
  margin-top: 14px;
  color: var(--m);
  font-size: .85rem;
}

.buddy-member-card {
  grid-row: span 2;
}

.buddy-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.buddy-profile h3 {
  margin-bottom: 3px;
}

.buddy-code {
  width: fit-content;
  margin: 0 auto 18px;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
}

.buddy-code svg {
  display: block;
  width: 140px;
}

.buddy-form {
  display: grid;
  gap: 9px;
}

.buddy-form label {
  color: var(--m);
  font-size: .82rem;
  font-weight: 600;
}

.buddy-form select {
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--t);
  font: inherit;
}

.buddy-form select:focus {
  outline: 0;
  border-color: var(--g);
}

.buddy-invite-status {
  grid-column: 1 / -1;
}

.buddy-invite-status > .btn {
  margin-top: 16px;
}

.buddy-response-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.dgrid.trainer-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .dgrid.trainer-grid { grid-template-columns: 1fr 1fr; } }

@media (max-width: 860px) {
  .hero { min-height: 100svh; }
  .hero .in { padding: 100px 0 60px; }
  .hero .cta .btn { flex: 1; text-align: center; }
  section.s { padding: 60px 0; }
  .wrap { padding: 0 18px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div { padding: 20px 16px; }
  .box { padding: 26px 20px; }
  .dgrid.trainer-grid { grid-template-columns: 1fr; }
  .buddy-grid { grid-template-columns: 1fr; }
  .buddy-member-card { grid-row: auto; }
  .buddy-invite-status { grid-column: auto; }

  /* Bottom tab bar instead of sidebar */
  .portal { display: block; }
  aside {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: flex;
    height: auto;
    flex-direction: row;
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line);
    border-right: 0;
    border-bottom: 0;
  }
  aside .logo { display: none; }
  aside button.nv { flex: 1; width: auto; margin: 0; padding: 10px 4px; font-size: .74rem; text-align: center; }
  aside .out { margin: 0; }
  .main { padding: 20px 16px 96px; }
  .main h1 { font-size: 1.35rem; }
  .main header { margin-bottom: 20px; padding-bottom: 16px; }
  .main header .btn { width: 100%; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpis .card:first-child { grid-column: 1 / -1; }
  .card { padding: 20px 16px; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .updates-heading { align-items: flex-start; flex-direction: column; }
  .updates-heading .btn { width: auto; }

  /* Tables become stacked cards */
  .tw table, .tw tbody, .tw tr, .tw td { display: block; width: 100%; }
  .tw thead { display: none; }
  .tw tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tw tr:last-child { border-bottom: 0; }
  .tw td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .tw td[data-label]::before { content: attr(data-label); color: var(--m); font-size: .75rem; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; text-align: left; }
  .tw td.act { justify-content: flex-end; padding-top: 10px; }
  .tw td.act .btn { width: 100%; padding: 10px; }
  .tw td.act .b { margin-left: auto; }
  .tw td.empty { justify-content: center; text-align: center; }
}

/* First-visit facility tour */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 7, 15, .78);
}

.tour-card {
  width: min(100%, 520px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.tour-visual {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(16, 185, 129, .2), transparent 60%),
    var(--bg);
}

.tour-visual > span:first-child {
  font-size: 4rem;
  line-height: 1;
}

.tour-visual-label {
  color: var(--g);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: 2px;
}

.tour-step {
  margin-bottom: 6px;
  color: var(--g);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.tour-card h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.tour-description {
  min-height: 4.5em;
  color: var(--m);
  font-size: .95rem;
}

.tour-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.tour-card :focus-visible,
.updates-card :focus-visible {
  outline: 2px solid var(--g);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .tour-card {
    padding: 18px;
  }

  .tour-visual {
    min-height: 145px;
  }
}

/* Floating class assistant */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 55;
}

.chat-launcher {
  display: flex;
  width: 60px;
  height: 60px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--g);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  color: #04130d;
  font-size: 1.5rem;
  cursor: pointer;
  transition: transform .2s, background .2s;
}

.chat-launcher:hover {
  transform: translateY(-3px);
  background: #34d399;
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  width: min(360px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 130px));
  min-height: 320px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .45);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #0e1626;
}

.chat-header h2 {
  font-size: 1rem;
}

.chat-header p {
  margin-top: 2px;
  color: var(--m);
  font-size: .78rem;
}

.chat-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--m);
  font-size: 1.5rem;
  cursor: pointer;
}

.chat-close:hover {
  background: var(--line);
  color: var(--t);
}

.chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
}

.chat-message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: .88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.bot-message {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--t);
}

.user-message {
  align-self: flex-end;
  background: rgba(16, 185, 129, .2);
  color: var(--t);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--t);
  font: inherit;
  font-size: .88rem;
}

.chat-form input:focus {
  outline: 0;
  border-color: var(--g);
}

.chat-form .btn {
  padding: 9px 14px;
  font-size: .85rem;
}

@media (max-width: 860px) {
  .chat-widget {
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .chat-panel {
    bottom: 72px;
    height: min(460px, calc(100dvh - 180px));
  }
}
