:root {
  --bg: #05050a;
  --text: #f4f4f7;
  --muted: #9a9aa8;
  --soft: #c8c8d2;
  --line: rgba(255, 255, 255, 0.1);
  --glass: rgba(18, 14, 28, 0.55);
  --glass-strong: rgba(12, 10, 20, 0.72);
  --violet: #8b5cf6;
  --violet-hot: #a78bfa;
  --violet-glow: rgba(139, 92, 246, 0.45);
  --sidebar-w: 280px;
  --font: "Outfit", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

button,
textarea,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— Background (still + crackling violet edges) —— */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #05050a;
}

.bg__still,
.bg__glow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.bg__glow {
  filter: url(#bgCrackle) brightness(1.45) contrast(1.5) saturate(1.6);
  mix-blend-mode: screen;
  opacity: 0.62;
  animation: bgGlowPulse 9s ease-in-out infinite;
  will-change: opacity;
}

.bg__svg {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

@keyframes bgGlowPulse {
  0%,
  100% {
    opacity: 0.48;
  }
  50% {
    opacity: 0.78;
  }
}

.bg__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, transparent 20%, rgba(5, 5, 10, 0.35) 70%, rgba(5, 5, 10, 0.55) 100%),
    linear-gradient(180deg, rgba(5, 5, 10, 0.25) 0%, transparent 35%, rgba(5, 5, 10, 0.4) 100%);
  pointer-events: none;
}

body[data-motion="off"] .bg__glow {
  display: none;
  animation: none;
}

/* —— Shared —— */
.logo,
.auth-card__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
}

.logo__mark-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 2px;
  background: transparent;
}

.logo__mark {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  object-fit: contain;
}

.logo__text {
  line-height: 1;
}

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.composer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: min(720px, calc(100% - 32px));
  padding: 10px 12px 10px 14px;
  border-radius: 999px;
  background: rgba(20, 16, 30, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.08),
    0 18px 50px rgba(0, 0, 0, 0.35);
}

.composer:has(.composer__attach:not([hidden])) {
  border-radius: 22px;
}

.composer__attach {
  order: -1;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 2px 4px;
}

.composer__attach[hidden] {
  display: none !important;
}

.composer__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
}

.composer__chip img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.composer__chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.composer__chip-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.composer__chip-remove:hover {
  color: #fff;
}

.composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.4;
  min-height: 24px;
  max-height: 120px;
  padding: 8px 4px;
  min-width: 0;
}

.composer textarea::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.composer__history,
.composer__plus {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0;
}

.composer__history:hover,
.composer__plus:hover,
.composer__attach-wrap.is-open .composer__plus {
  background: rgba(255, 255, 255, 0.1);
}

.composer__history svg {
  display: block;
}

.composer__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.composer__attach-wrap {
  position: relative;
}

.composer__menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 132px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 10, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 2px;
  z-index: 12;
}

.composer__menu[hidden] {
  display: none !important;
}

.composer__menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
}

.composer__menu-item:hover {
  background: rgba(139, 92, 246, 0.22);
  color: #fff;
}

.composer__paste {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  width: 28px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 0;
  transition: color 0.15s ease, opacity 0.15s ease;
  opacity: 0.85;
}

.composer__paste:hover {
  color: rgba(255, 255, 255, 0.82);
  opacity: 1;
  background: transparent;
}

.composer__paste svg {
  display: block;
}

.composer__send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, #9b6cff, #7c3aed);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px var(--violet-glow);
  flex-shrink: 0;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.composer__send:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.composer__send:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}

/* —— Landing —— */
.landing {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: stretch;
  padding: 0 0 48px;
  animation: fadeUp 0.8s var(--ease) both;
}

body[data-view="chat"] .landing {
  display: none !important;
}

body[data-view="software"] .landing,
body[data-view="subscription"] .landing,
body[data-view="checkout"] .landing,
body[data-view="account"] .landing {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.topbar--landing {
  width: 100%;
  box-sizing: border-box;
  padding: 14px clamp(16px, 4vw, 28px);
  z-index: 6;
}

.topbar__inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
}

body[data-view="software"] .topbar--landing,
body[data-view="subscription"] .topbar--landing,
body[data-view="checkout"] .topbar--landing,
body[data-view="account"] .topbar--landing {
  position: sticky;
  top: 0;
  flex-shrink: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  transition:
    background 0.28s ease,
    border-color 0.28s ease,
    backdrop-filter 0.28s ease;
}

body.is-topbar-solid[data-view="software"] .topbar--landing,
body.is-topbar-solid[data-view="subscription"] .topbar--landing,
body.is-topbar-solid[data-view="checkout"] .topbar--landing,
body.is-topbar-solid[data-view="account"] .topbar--landing,
body.is-topbar-solid[data-view="landing"] .topbar--landing {
  background: rgba(5, 5, 10, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body[data-view="software"] .page {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 28px) 48px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

body[data-view="subscription"] .page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 28px) 48px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

body[data-view="account"] .page {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 28px) 48px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.5vw, 40px);
  flex-wrap: wrap;
}

.topnav__link {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.92rem;
  font-weight: 450;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.topnav__link:hover,
.topnav__link.is-active {
  color: #fff;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-dd {
  position: relative;
}

.lang-dd__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lang-dd__btn:hover,
.lang-dd.is-open .lang-dd__btn {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(167, 139, 250, 0.45);
  color: #fff;
}

.lang-dd__btn svg {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.lang-dd.is-open .lang-dd__btn svg {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 10, 22, 0.92);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  z-index: 40;
  display: none;
  gap: 2px;
}

.lang-dd.is-open .lang-menu {
  display: grid;
}

.lang-menu[hidden] {
  display: none !important;
}

.lang-menu__item {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  padding: 9px 11px;
  border-radius: 10px;
  cursor: pointer;
}

.lang-menu__item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.lang-menu__item.is-active {
  background: rgba(139, 92, 246, 0.28);
  color: #fff;
}

@media (max-width: 720px) {
  .topbar__inner {
    grid-template-columns: auto auto;
    grid-template-areas:
      "logo actions"
      "nav nav";
    row-gap: 12px;
  }

  .topbar__inner .logo {
    grid-area: logo;
  }

  .topbar__inner .topnav {
    grid-area: nav;
    justify-content: flex-start;
  }

  .topbar__inner .topbar__actions {
    grid-area: actions;
    justify-self: end;
  }
}

.hero {
  text-align: center;
  align-self: end;
  margin-bottom: 28px;
  padding-top: 8vh;
}

.hero__title {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero__sub {
  margin: 6px 0 0;
  font-size: clamp(1.5rem, 3.4vw, 2.35rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.92);
}

.hero__hint {
  margin: 22px 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.42);
  font-weight: 400;
}

.composer--hero {
  align-self: start;
  margin-top: 8px;
  animation: fadeUp 1s var(--ease) 0.12s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— App / chat —— */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  transition: grid-template-columns 0.35s var(--ease);
}

.app[hidden],
body:not([data-view="chat"]) .app {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

body[data-view="landing"] .app {
  display: none !important;
}

body[data-sidebar="closed"] .app {
  grid-template-columns: 0 1fr;
}

.sidebar {
  position: relative;
  z-index: 3;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px 18px;
  background: linear-gradient(180deg, rgba(10, 8, 18, 0.78), rgba(8, 6, 14, 0.55));
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  overflow: visible;
  transition: transform 0.35s var(--ease), opacity 0.25s ease;
}

body[data-sidebar="closed"] .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  opacity: 0;
  pointer-events: none;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.new-chat {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.2s ease;
}

.new-chat:hover {
  background: rgba(255, 255, 255, 0.09);
}

.new-chat__plus {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(139, 92, 246, 0.25);
  color: var(--violet-hot);
  font-size: 1rem;
}

.history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 2px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.history__group {
  margin-bottom: 18px;
}

.history__label {
  margin: 0 0 8px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
  font-weight: 500;
}

.history__row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-radius: 12px;
}

.history__row.is-active {
  background: rgba(139, 92, 246, 0.18);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.28);
}

.history__row:hover,
.history__row.is-menu-open {
  background: rgba(255, 255, 255, 0.05);
}

.history__row.is-active:hover,
.history__row.is-active.is-menu-open {
  background: rgba(139, 92, 246, 0.22);
}

.history__item {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 12px;
  padding: 10px 8px 10px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  font-size: 0.88rem;
  min-width: 0;
}

.history__row.is-active .history__item {
  color: #fff;
}

.history__item svg {
  opacity: 0.55;
}

.history__row.is-active .history__item svg,
.history__row.is-pinned .history__item svg {
  opacity: 0.95;
  color: var(--violet-hot);
}

.history__row.is-archived .history__item {
  opacity: 0.72;
}

.history__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history__time {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.35);
}

.history__row:hover .history__time,
.history__row.is-menu-open .history__time {
  opacity: 0;
}

.history__more {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  margin-right: 4px;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.history__row:hover .history__more,
.history__row.is-menu-open .history__more {
  opacity: 1;
  pointer-events: auto;
}

.history__more:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.history__menu {
  position: absolute;
  top: calc(100% - 4px);
  right: 6px;
  z-index: 12;
  min-width: 148px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 12, 24, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  display: none;
  gap: 2px;
}

.history__row.is-menu-open .history__menu:not([hidden]) {
  display: grid;
}

.history__menu[hidden] {
  display: none !important;
}

.history__menu button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  font: inherit;
  font-size: 0.86rem;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
}

.history__menu button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.history__menu button.is-danger {
  color: #f0a8b8;
}

.history__menu button.is-danger:hover {
  background: rgba(240, 168, 184, 0.12);
}

.sidebar-reopen {
  position: fixed;
  top: 18px;
  left: 16px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 10, 20, 0.65);
  color: #fff;
  backdrop-filter: blur(14px);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

body[data-sidebar="open"] .sidebar-reopen {
  display: none;
}

.main {
  position: relative;
  min-width: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 10px 18px 18px;
}

.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 8px 4px;
}

.chat-title {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 2px;
}

.chat-model {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.4);
  padding-left: 2px;
}

.chat-head__right {
  display: flex;
  gap: 2px;
}

.thread {
  overflow-y: auto;
  padding: 12px 8px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.msg {
  max-width: min(720px, 92%);
  animation: fadeUp 0.4s var(--ease) both;
}

.msg.user {
  align-self: flex-end;
  background: rgba(24, 20, 36, 0.72);
  border: 1px solid rgba(139, 92, 246, 0.28);
  box-shadow: 0 0 28px rgba(139, 92, 246, 0.12);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user img {
  display: block;
  max-width: min(320px, 70vw);
  border-radius: 12px;
  margin-top: 8px;
}

.msg.user p {
  margin: 0 0 6px;
}

.msg.user a {
  color: var(--violet-hot);
  text-decoration: underline;
}

.msg.bot {
  align-self: stretch;
  max-width: min(760px, 100%);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
}

.msg__mark {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.msg__mark .logo__mark-wrap {
  width: 18px;
  height: 18px;
}

.msg__mark .logo__mark {
  width: 18px;
  height: 18px;
}

.msg__meta {
  margin-top: 6px;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.38);
}

.msg.user .msg__meta {
  text-align: right;
  margin-top: 8px;
}

.msg__card {
  background: rgba(16, 12, 26, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  padding: 16px 18px 12px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Petite bulle de réflexion — pas une carte énorme */
.msg--thinking {
  grid-template-columns: 22px auto;
  gap: 8px;
  max-width: none;
  width: fit-content;
  align-items: center;
}

.msg--thinking .msg__mark {
  width: 22px;
  height: 22px;
  margin-top: 0;
}

/* Surbrillance UNIQUEMENT sur le logo en réflexion, masquée sur la forme (pas le transparent) */
.msg--thinking .logo__mark-wrap {
  overflow: hidden;
}

.msg--thinking .logo__mark-wrap::after {
  content: "";
  position: absolute;
  inset: -8%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    transparent 28%,
    rgba(255, 255, 255, 0.55) 40%,
    #fff 46%,
    #fff 50%,
    #f3e8ff 54%,
    rgba(255, 255, 255, 0.55) 60%,
    transparent 72%,
    transparent 100%
  );
  background-size: 240% 100%;
  animation: logoShine 1.5s ease-in-out infinite;
  pointer-events: none;
  -webkit-mask-image: var(--mark-url, url("/relwyn-mark.png?v=tr2"));
  mask-image: var(--mark-url, url("/relwyn-mark.png?v=tr2"));
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  filter: brightness(1.8) contrast(1.15) drop-shadow(0 0 5px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 10px rgba(200, 160, 255, 1));
  opacity: 1;
}

.msg--thinking .logo__mark {
  filter: brightness(1.25);
}

@keyframes logoShine {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

.msg__thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16, 12, 26, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 0;
}

.msg__thinking span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(220, 190, 255, 0.85);
  animation: thinkDot 1.05s ease-in-out infinite;
}

.msg__thinking span:nth-child(2) {
  animation-delay: 0.15s;
}

.msg__thinking span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes thinkDot {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.msg__card pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.45);
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
}

.msg__card img,
.msg__card video {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: 12px;
  margin-top: 10px;
  background: #eef3f8;
}

.msg__actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0.55;
}

.msg__actions button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.msg__actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  opacity: 1;
}

.composer--dock {
  width: min(760px, 100%);
  justify-self: center;
  margin-bottom: 8px;
}

/* —— Account dock (sidebar footer) —— */
.account-dock {
  position: relative;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 6;
}

body[data-view="landing"] .account-dock {
  display: none;
}

.account-panel__lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.account-section-title {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-form--secure {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.account-form__actions--stack {
  margin-top: 14px;
  flex-direction: column;
  align-items: stretch;
}

.btn-danger {
  appearance: none;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-weight: 500;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

.account-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-radius: 14px;
  width: 100%;
  min-width: 0;
  height: auto;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.account-chip:hover,
.account-chip[aria-expanded="true"] {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: none;
}

.account-chip__avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #7c3aed, #4c1d95);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.account-chip__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1;
  text-align: left;
}

.account-chip__name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.account-chip__hint {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.42);
}

.account-fab {
  position: fixed;
  left: 16px;
  bottom: 24px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 10, 20, 0.78);
  color: #fff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  display: none;
  place-items: center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.account-fab:hover,
.account-fab[aria-expanded="true"] {
  border-color: rgba(139, 92, 246, 0.45);
}

body[data-view="chat"][data-sidebar="closed"] .account-fab {
  display: grid;
}

.account-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  width: auto;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  background: rgba(12, 10, 20, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 14px 16px 16px;
  animation: fadeUp 0.28s var(--ease) both;
  z-index: 8;
}

.account-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.account-panel__head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.account-form {
  display: grid;
  gap: 12px;
}

.account-form label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.account-form input,
.account-form select {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  color: #fff;
  outline: none;
}

.account-form input:focus,
.account-form select:focus {
  border-color: rgba(139, 92, 246, 0.55);
}

.account-form .check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
}

.account-form .check input {
  width: 16px;
  height: 16px;
  accent-color: var(--violet);
}

.tone-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.tone-field legend {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 6px;
  padding: 0;
}

.tone-field__hint {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.35;
}

.tone-grid {
  display: grid;
  gap: 8px;
}

.tone-option {
  display: block;
  cursor: pointer;
}

.tone-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tone-option__card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tone-option__card strong {
  font-size: 0.86rem;
  font-weight: 560;
  color: #fff;
}

.tone-option__card small {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.3;
}

.tone-option:hover .tone-option__card {
  border-color: rgba(255, 255, 255, 0.2);
}

.tone-option input:checked + .tone-option__card {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.14);
}

.account-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: linear-gradient(145deg, #9b6cff, #7c3aed);
  color: #fff;
  font-weight: 560;
  cursor: pointer;
}

.btn-ghost {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.account-status {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-size: 0.78rem;
  color: var(--violet-hot);
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(var(--sidebar-w), 86vw);
    z-index: 8;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.45);
  }

  body[data-sidebar="closed"] .sidebar {
    transform: translateX(-105%);
  }

  body[data-view="chat"][data-sidebar="open"] .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 7;
    background: rgba(0, 0, 0, 0.45);
    border: 0;
    cursor: pointer;
  }

  .account-fab {
    left: 12px;
    bottom: 20px;
  }

  .hero {
    padding-top: 4vh;
  }

  .landing {
    padding-bottom: 28px;
  }

  .composer--hero {
    width: min(720px, calc(100% - 20px));
  }
}

/* —— Auth popup —— */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-modal[hidden] {
  display: none !important;
}

.auth-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 3, 10, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(12, 10, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 40px rgba(139, 92, 246, 0.16);
  animation: fadeUp 0.35s var(--ease) both;
}

.auth-card__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.auth-card__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.auth-card__brand {
  margin: 0 0 10px;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.auth-card__lead {
  margin: 8px 0 18px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.92rem;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.auth-form input {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(139, 92, 246, 0.55);
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider[hidden],
.auth-google[hidden] {
  display: none !important;
}

.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 550;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.auth-google:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.auth-google svg {
  flex-shrink: 0;
}

.auth-modal.is-login [data-auth-name] {
  display: none;
}

.auth-error {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.82rem;
  color: #f0a8b8;
}

.auth-forgot {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(196, 181, 253, 0.85);
  font: inherit;
  font-size: 0.82rem;
  padding: 0;
  margin: -4px 0 0;
  justify-self: end;
  cursor: pointer;
}

.auth-forgot:hover {
  color: #ddd6fe;
}

.auth-note {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.62);
}

.auth-note:empty,
.auth-forgot[hidden],
.auth-form label[hidden],
.auth-modal [hidden].auth-switch,
.auth-modal [hidden].auth-google,
.auth-modal [hidden].auth-divider {
  display: none;
}

.auth-submit {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 600;
}

.auth-switch {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.86rem;
  margin: 12px auto 8px;
  display: block;
  cursor: pointer;
}

.auth-switch:hover {
  color: #fff;
}

.auth-guest {
  width: 100%;
}

.landing__home {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  justify-items: center;
  padding: 0 24px;
}

.landing__home[hidden],
.page[hidden],
.landing-chats[hidden],
.site-footer[hidden],
.settings-panel[hidden] {
  display: none !important;
}

body:not([data-view="landing"]) .landing__home,
body:not([data-view="landing"]) .landing-chats {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.landing-chats {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.48);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 4px;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: color 0.2s ease, transform 0.2s ease;
  align-self: end;
  justify-self: center;
  z-index: 2;
}

.landing-chats:hover {
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(2px);
}

.landing-chats svg {
  opacity: 0.85;
}

.landing-chats[hidden] {
  display: none !important;
}

.site-footer {
  width: 100%;
  margin-top: 28px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 10, 0.62);
  padding: 36px clamp(16px, 4vw, 28px) 48px;
  box-sizing: border-box;
}

.site-footer[hidden] {
  display: none !important;
}

.site-footer__inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 28px;
}

.site-footer__top {
  display: grid;
  gap: 6px;
}

.site-footer__brand {
  font-size: 1rem;
}

.site-footer__tag {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.48);
}

.site-footer__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 28px;
}

.site-footer__col {
  display: grid;
  gap: 10px;
  align-content: start;
}

.site-footer__heading {
  margin: 0 0 2px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.site-footer__col a,
.site-footer__link {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  text-align: left;
  width: fit-content;
}

.site-footer__col a:hover,
.site-footer__link:hover {
  color: #fff;
}

.site-footer__meta {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.42);
  max-width: 28ch;
}

.site-footer__col:last-child .site-footer__meta {
  max-width: 36ch;
}

.site-footer__copy {
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.34);
}

@media (max-width: 900px) {
  .site-footer__cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .site-footer__cols {
    grid-template-columns: 1fr;
  }
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
}

.site-footer__nav a,
.site-footer__nav .site-footer__link {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.page {
  width: min(920px, 100%);
  margin: 12px auto 0;
  padding: 8px 4px 56px;
  animation: fadeUp 0.55s var(--ease) both;
  justify-self: center;
}

.page__kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(196, 181, 253, 0.78);
}

.page__title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.page__lead {
  margin: 0 0 18px;
  max-width: 46rem;
  color: rgba(255, 255, 255, 0.68);
  font-size: 1.05rem;
  line-height: 1.55;
}

.page__note {
  margin: 0 0 22px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.9rem;
}

.page__cta {
  margin-top: 0;
  padding: 12px 20px;
  border-radius: 14px;
}

.page-block {
  margin: 36px 0 28px;
}

.page-block__title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-block__lead {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 40rem;
}

.page-block--cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 22px;
  margin-top: 32px;
  margin-bottom: 0;
}

.page__link {
  color: rgba(196, 181, 253, 0.92);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.page__link:hover {
  color: #fff;
}

.story-steps {
  list-style: none;
  margin: 28px 0 8px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.story-step {
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.story-step h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.story-step p {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.9rem;
  line-height: 1.45;
}

.point-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.point {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(165deg, rgba(139, 92, 246, 0.1), rgba(255, 255, 255, 0.02));
}

.point__n {
  display: block;
  margin-bottom: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: rgba(196, 181, 253, 0.7);
  font-weight: 600;
}

.point h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}

.point p {
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.88rem;
  line-height: 1.45;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.faq {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 16px;
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 0;
  font-weight: 550;
  font-size: 0.98rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  float: right;
  color: rgba(196, 181, 253, 0.75);
  font-weight: 500;
}

.faq[open] summary::after {
  content: "–";
}

.faq p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.92rem;
  line-height: 1.5;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.feature {
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.feature h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

.feature p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* —— Subscription cards + compare —— */
.page--subscription {
  max-width: 1180px;
}

.page--subscription .page__kicker {
  color: #c4b5fd;
  letter-spacing: 0.18em;
}

.page--subscription .page__title {
  letter-spacing: -0.03em;
}

.page--subscription .page__lead {
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.plan-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
  margin: 28px 0 36px;
  padding-top: 14px; /* room for MOST POPULAR badge — cards stay level */
}

.plan-card {
  position: relative;
  isolation: isolate;
  border-radius: 22px;
  min-height: 100%;
}

.plan-card__orbit {
  display: none;
}

.plan-card__shell {
  position: relative;
  z-index: 1;
  height: 100%;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 8, 18, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  overflow: visible;
}

.plan-card__body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 18px 18px;
  box-sizing: border-box;
}

.plan-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 720;
  letter-spacing: 0.08em;
}

.plan-card__tag {
  margin: 8px 0 0;
  min-height: 2.6em;
  font-size: 0.82rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.52);
}

.plan-card__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 16px 0 14px;
}

.plan-card__amount {
  font-size: 2rem;
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1;
}

.plan-card__period {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.48);
}

.plan-card__features {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 10px;
  flex: 1;
}

.plan-card__features li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 0.84rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.78);
}

.plan-card__check {
  color: #c4b5fd;
  font-weight: 700;
  line-height: 1.35;
}

.plan-card__cta {
  appearance: none;
  width: 100%;
  margin-top: auto;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 620;
  font-size: 0.92rem;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.plan-card__cta:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.plan-card__cta:disabled {
  opacity: 0.72;
  cursor: default;
}

.plan-card__cta--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
}

.plan-card__cta--hot {
  border: 0;
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 48%, #6366f1 100%);
  box-shadow: 0 10px 28px rgba(124, 58, 237, 0.38);
}

.plan-card__cta--hot:hover:not(:disabled) {
  background: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 48%, #818cf8 100%);
  box-shadow: 0 14px 34px rgba(124, 58, 237, 0.5);
}

.plan-card.is-current .plan-card__shell {
  border-color: rgba(167, 139, 250, 0.55);
}

.plan-card__badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.55);
}

/* Premium: orbiting light / reflet around card + badge */
.plan-card--popular {
  padding: 3px;
  margin-top: 0;
  align-self: stretch;
}

.plan-card--popular .plan-card__orbit {
  display: block;
  position: absolute;
  inset: -2px;
  border-radius: 24px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.plan-card--popular .plan-card__orbit::before {
  content: "";
  position: absolute;
  inset: -55%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 220deg,
    rgba(255, 255, 255, 0.08) 255deg,
    #ffffff 275deg,
    #f5e9ff 288deg,
    #e9d5ff 300deg,
    #c084fc 318deg,
    #a78bfa 330deg,
    #7c3aed 342deg,
    #38bdf8 352deg,
    transparent 360deg
  );
  animation: planOrbit 2.8s linear infinite;
  filter: blur(0.4px);
}

.plan-card--popular .plan-card__orbit::after {
  content: "";
  position: absolute;
  inset: 2.5px;
  border-radius: 21.5px;
  background: rgba(8, 6, 16, 0.94);
  box-shadow: inset 0 0 24px rgba(124, 58, 237, 0.18);
}

.plan-card--popular .plan-card__shell {
  height: 100%;
  border-color: rgba(196, 181, 253, 0.35);
  background: linear-gradient(180deg, rgba(48, 24, 92, 0.42), rgba(10, 8, 18, 0.72));
  box-shadow:
    0 0 0 1px rgba(196, 181, 253, 0.35),
    0 0 28px rgba(168, 85, 247, 0.55),
    0 0 64px rgba(124, 58, 237, 0.35),
    0 22px 50px rgba(0, 0, 0, 0.45);
}

.plan-card--popular .plan-card__body {
  padding-top: 28px;
}

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

@property --plan-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@supports ((background: paint(something)) or (background: conic-gradient(from var(--plan-angle), red, blue))) {
  .plan-card--popular .plan-card__orbit::before {
    inset: -40%;
    background: conic-gradient(
      from var(--plan-angle),
      transparent 0deg,
      transparent 255deg,
      rgba(255, 255, 255, 0.08) 285deg,
      #f5e9ff 305deg,
      #c084fc 322deg,
      #7c3aed 338deg,
      #38bdf8 350deg,
      transparent 360deg
    );
    animation: planOrbitAngle 3.2s linear infinite;
  }
  @keyframes planOrbitAngle {
    to {
      --plan-angle: 360deg;
    }
  }
}

.plan-compare {
  margin: 8px 0 12px;
}

.plan-compare__title {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.plan-table-wrap {
  overflow-x: auto;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 6, 16, 0.48);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.plan-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.plan-table th,
.plan-table td {
  padding: 14px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.88rem;
  vertical-align: middle;
}

.plan-table thead th {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  font-weight: 720;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.03);
  padding-top: 18px;
  padding-bottom: 16px;
}

.plan-table__cube {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 2px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.55);
  vertical-align: middle;
}

.plan-table__label,
.plan-table tbody th {
  text-align: left;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
}

.plan-table__ico {
  display: inline-grid;
  place-items: center;
  width: 1.4em;
  margin-right: 8px;
  color: rgba(196, 181, 253, 0.85);
  font-size: 0.85rem;
}

.plan-table__plan.is-highlight {
  color: #e9ddff;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.28), rgba(124, 58, 237, 0.08));
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.35);
}

.plan-table__plan.is-pro {
  color: #f3e8ff;
}

.plan-table__plan.is-current {
  box-shadow: inset 0 -2px 0 rgba(167, 139, 250, 0.85);
}

.plan-table td.is-highlight-col {
  background: rgba(124, 58, 237, 0.1);
  box-shadow: inset 1px 0 0 rgba(167, 139, 250, 0.22), inset -1px 0 0 rgba(167, 139, 250, 0.22);
}

.plan-table thead th.is-highlight {
  border-radius: 14px 14px 0 0;
}

.plan-table__price {
  font-size: 1.15rem;
  font-weight: 650;
  color: #fff;
  letter-spacing: -0.02em;
}

.plan-table__period,
.plan-table__unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.48);
}

.plan-table__inf {
  display: inline-block;
  font-size: 1.55rem;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0.95;
  transform: translateY(1px);
}

.plan-table tbody tr:last-child th,
.plan-table tbody tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 1100px) {
  .plan-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .plan-cards {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .plan-card--popular {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .plan-card--popular .plan-card__orbit::before {
    animation: none;
  }
}

.mark {
  display: inline-grid;
  place-items: center;
  width: 1.4em;
  font-weight: 700;
  font-size: 1rem;
}

.mark--yes {
  color: #86efac;
}

.mark--no {
  color: rgba(255, 255, 255, 0.28);
}

.spend-card {
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.spend-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.78);
}

.spend-card__plan {
  color: rgba(196, 181, 253, 0.9);
  font-weight: 500;
}

.spend-card__hint {
  margin: 6px 0 10px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
}

.spend-card__value {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.78);
}

.spend-card__value strong {
  font-size: 1.15rem;
  font-weight: 650;
  color: #fff;
}

.spend-card__sep {
  margin: 0 4px;
  opacity: 0.45;
}

.spend-card__unit {
  margin-left: 6px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
}

.spend-card__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.spend-card__bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #c084fc);
  transition: width 0.35s ease;
}

.page--account {
  width: min(1040px, 100%);
  margin-top: 4px;
  padding-bottom: 40px;
}

.settings {
  display: grid;
  gap: 20px;
}

.settings__top {
  display: grid;
  gap: 14px;
}

.settings__back {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  width: fit-content;
  padding: 0;
}

.settings__back:hover {
  color: #fff;
}

.settings__identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding: 18px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.settings__avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(145deg, #8b5cf6, #5b21b6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
}

.settings__identity > div {
  flex: 1 1 12rem;
  min-width: 0;
}

.settings__title {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.settings__subtitle {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.9rem;
  max-width: 40rem;
  line-height: 1.45;
}

.settings__badge {
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.4);
  background: rgba(139, 92, 246, 0.18);
  color: #ede4ff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.settings__shell {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings__nav {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.28);
  position: sticky;
  top: 72px;
}

.settings__tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  padding: 10px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.settings__tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.settings__tab.is-active {
  color: #fff;
  background: rgba(139, 92, 246, 0.28);
}

.settings__main {
  min-width: 0;
  padding: 2px 2px 20px;
}

.settings-panel[hidden] {
  display: none !important;
}

.settings-panel__title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.settings-panel__lead,
.settings-panel__note {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.52);
  line-height: 1.5;
  font-size: 0.92rem;
  max-width: 36rem;
}

.settings-panel__note {
  margin-top: 16px;
  margin-bottom: 0;
  font-size: 0.86rem;
}

.settings-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.settings-card--wide {
  grid-column: 1 / -1;
  background: linear-gradient(165deg, rgba(139, 92, 246, 0.14), rgba(255, 255, 255, 0.03));
  border-color: rgba(167, 139, 250, 0.22);
}

.settings-card h3 {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.settings-card__value {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.settings-card__meta {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.84rem;
  line-height: 1.4;
}

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

.account-form--page {
  max-width: 520px;
}

.usage-board {
  display: grid;
  gap: 16px;
}

.usage-board__hero {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(167, 139, 250, 0.28);
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.16), rgba(255, 255, 255, 0.03));
}

.usage-board__label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.usage-board__big {
  margin: 0 0 14px;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.usage-board__big strong {
  font-size: 1.8rem;
  color: #fff;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-right: 6px;
}

.spend-card__bar--lg {
  height: 8px;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.usage-stat {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 6px;
}

.usage-stat span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
}

.usage-stat strong {
  font-size: 1.05rem;
  font-weight: 600;
}

.plan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 16px;
}

.plan-summary__label {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-summary h3 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.plan-summary p {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
}

.plan-points {
  margin: 0;
  padding-left: 1.15rem;
  color: rgba(255, 255, 255, 0.62);
  line-height: 1.6;
}

.danger-list {
  display: grid;
  gap: 12px;
}

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
}

.danger-row h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.danger-row p {
  margin: 0;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.86rem;
  line-height: 1.4;
}

.account-status {
  min-height: 1.2em;
  margin: 0 0 12px;
  font-size: 0.86rem;
  color: rgba(196, 181, 253, 0.9);
}

@media (max-width: 860px) {
  .settings__shell {
    grid-template-columns: 1fr;
  }

  .settings__nav {
    position: static;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 4px;
  }

  .settings__identity {
    align-items: flex-start;
  }

  .settings__badge {
    margin-left: 0;
  }

  .plan-summary,
  .danger-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 960px) {
  .plan-table-wrap {
    margin-inline: -4px;
  }
}

@media (max-width: 720px) {
  .feature-grid,
  .settings-cards,
  .usage-grid,
  .story-steps,
  .point-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing,
  .composer--hero,
  .msg,
  .account-panel,
  .rw-dialog__card {
    animation: none;
  }

  .bg__glow {
    display: none;
    animation: none;
  }
}

/* —— Relwyn dialog —— */
.rw-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.rw-dialog[hidden] {
  display: none !important;
}

.rw-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 3, 10, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.rw-dialog__card {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 26px 24px 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 10, 22, 0.94);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), 0 0 36px rgba(139, 92, 246, 0.14);
  animation: fadeUp 0.28s var(--ease) both;
}

.rw-dialog__brand {
  margin: 0 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rw-dialog__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.rw-dialog__body {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.94rem;
  line-height: 1.5;
}

.rw-dialog__field {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}

.rw-dialog__field[hidden] {
  display: none !important;
}

.rw-dialog__field input {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 11px 12px;
  color: #fff;
  font: inherit;
  outline: none;
}

.rw-dialog__field input:focus {
  border-color: rgba(139, 92, 246, 0.55);
}

.rw-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.rw-dialog__actions .btn-ghost,
.rw-dialog__actions .btn-primary,
.rw-dialog__actions .btn-danger {
  min-width: 96px;
  padding: 10px 14px;
  border-radius: 12px;
}

/* —— Checkout —— */
body[data-view="checkout"] .page {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 28px) 56px;
  box-sizing: border-box;
  flex: 0 0 auto;
}

.checkout__back {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  margin-bottom: 18px;
  cursor: pointer;
  font-size: 0.9rem;
}

.checkout__back:hover {
  color: #fff;
}

.checkout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 22px;
  align-items: start;
}

.checkout[hidden],
.checkout-done[hidden] {
  display: none !important;
}

.checkout__summary,
.checkout__pay {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(20, 15, 34, 0.78), rgba(10, 8, 18, 0.72));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: clamp(20px, 3vw, 30px);
}

.checkout__summary {
  position: sticky;
  top: 84px;
  overflow: hidden;
}

.checkout__summary::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.28), transparent 65%);
  pointer-events: none;
}

.checkout__plan {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 2.7rem);
  font-weight: 650;
  letter-spacing: 0.02em;
}

.checkout__tagline {
  margin: 6px 0 20px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.95rem;
}

.checkout__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 20px;
}

.checkout__amount {
  font-size: 2.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.checkout__period {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

.checkout__perks {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.checkout__perks li {
  position: relative;
  padding-left: 26px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.93rem;
}

.checkout__perks li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.18);
}

.checkout__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
}

.checkout__total strong {
  font-size: 1.15rem;
  font-weight: 600;
}

.checkout__renew {
  margin: 14px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.45);
}

.checkout__title {
  margin: 0 0 16px;
  font-size: 1.2rem;
  font-weight: 600;
}

.checkout__field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
}

.checkout__field input {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 11px 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  outline: none;
}

.checkout__element {
  margin-bottom: 16px;
}

.checkout__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 150px;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
}

.checkout__loading[hidden] {
  display: none;
}

.checkout__spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: #a78bfa;
  animation: rwSpin 0.8s linear infinite;
}

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

.checkout__notice {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid rgba(139, 92, 246, 0.22);
  background: rgba(139, 92, 246, 0.08);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  line-height: 1.5;
}

.checkout__consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.66);
  cursor: pointer;
}

.checkout__consent input {
  margin-top: 3px;
  accent-color: #8b5cf6;
  flex-shrink: 0;
}

.checkout__consent a {
  color: #c4b5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.checkout__error {
  min-height: 1.2em;
  margin: 10px 0 6px;
  color: #fca5a5;
  font-size: 0.85rem;
}

.checkout__submit {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.3);
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.checkout__submit:hover:not(:disabled) {
  filter: brightness(1.08);
}

.checkout__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkout__submit.is-busy {
  cursor: wait;
}

.checkout__secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.46);
}

.checkout__seller {
  margin: 0;
  text-align: center;
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.34);
}

.checkout-done {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
  padding: clamp(40px, 8vw, 80px) 20px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(20, 15, 34, 0.78), rgba(10, 8, 18, 0.72));
}

.checkout-done__icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #9b6cff, #7c3aed);
  box-shadow: 0 0 40px var(--violet-glow);
  margin-bottom: 8px;
}

.checkout-done__title {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 600;
}

.checkout-done__lead {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.6);
}

.checkout-done__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
}

.checkout-done__account {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

@media (max-width: 860px) {
  .checkout {
    grid-template-columns: 1fr;
  }
  .checkout__summary {
    position: relative;
    top: 0;
  }
}

/* —— Account → subscription —— */
.billing-box {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 16px;
}

.billing-box[hidden] {
  display: none !important;
}

.billing-box__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.billing-box__status {
  margin: 0;
  font-size: 0.95rem;
}

.billing-box__btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.88rem;
}

.billing-box__btn:hover {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

.billing-box__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.billing-box__list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 14px;
  align-items: center;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
}

.billing-box__list a {
  color: #c4b5fd;
}

.billing-box__empty {
  display: block !important;
  color: rgba(255, 255, 255, 0.45);
}

/* —— Model picker (own API keys) —— */
.model-pick {
  position: relative;
  flex-shrink: 0;
}

.model-pick[hidden] {
  display: none !important;
}

.model-pick__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  max-width: 190px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.model-pick__btn:hover,
.model-pick__btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(167, 139, 250, 0.35);
}

.model-pick__logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.model-pick__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pick__btn svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.model-pick__btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.model-pick__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: 260px;
  max-height: min(360px, 60vh);
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 10, 20, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  display: grid;
  gap: 2px;
  z-index: 20;
}

.model-pick__menu[hidden] {
  display: none !important;
}

.model-pick__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.model-pick__item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.model-pick__item.is-active {
  background: rgba(139, 92, 246, 0.16);
}

.model-pick__item img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.model-pick__item span {
  display: grid;
  min-width: 0;
}

.model-pick__item strong {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-pick__item small {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
}

.model-pick__sep {
  height: 1px;
  margin: 4px 6px;
  background: rgba(255, 255, 255, 0.08);
}

.model-pick__plus {
  width: 20px;
  height: 20px;
  display: grid !important;
  place-items: center;
  border-radius: 999px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  font-size: 0.9rem;
  line-height: 1;
}

@media (max-width: 560px) {
  .model-pick__btn {
    max-width: 120px;
  }
}

.logo__mark-wrap--model .logo__mark {
  object-fit: contain;
}

/* Stacked model logos in chat history */
.model-stack {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.model-stack img {
  width: 16px;
  height: 16px;
  padding: 1px;
  object-fit: contain;
  border-radius: 999px;
  background: rgba(20, 16, 30, 0.95);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.model-stack img + img {
  margin-left: -8px;
}

/* Settings → Models */
.byok-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 22px;
}

.byok-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.byok-row > img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.byok-row__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.byok-row__main small {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.75rem;
}

.byok-row__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.byok-chip {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(139, 92, 246, 0.14);
  color: rgba(255, 255, 255, 0.85);
}

.byok-chip.is-empty {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.45);
}

.byok-row__actions {
  display: flex;
  gap: 6px;
}

.byok-row__actions .is-danger {
  color: #fca5a5;
}

@media (max-width: 640px) {
  .byok-row {
    grid-template-columns: 28px 1fr;
  }
  .byok-row__actions {
    grid-column: 1 / -1;
  }
}

.byok-form__title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.byok-providers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.byok-provider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}

.byok-provider img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.byok-provider.is-active {
  border-color: rgba(167, 139, 250, 0.6);
  background: rgba(139, 92, 246, 0.14);
}

.byok-form__hint {
  margin: -4px 0 8px;
  font-size: 0.8rem;
}

.byok-form__hint a {
  color: #c4b5fd;
}

.byok-picker {
  margin-top: 22px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  background: rgba(139, 92, 246, 0.05);
}

.byok-picker[hidden] {
  display: none !important;
}

.byok-picker input[type="search"] {
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font: inherit;
}

.byok-options {
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.byok-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.byok-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.byok-option span {
  display: grid;
  min-width: 0;
}

.byok-option small {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
}

.history__lead {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 18px;
}

/* Streamed reply: caret while text arrives */
.msg__card--streaming::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
  animation: rw-caret 1s steps(2, start) infinite;
}

@keyframes rw-caret {
  to {
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg__card--streaming::after {
    animation: none;
  }
}
