:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #66758a;
  --subtle: #93a1b4;
  --faint: #eef3f8;
  --line: #dfe7f1;
  --blue: #5f8fca;
  --teal: #6eb7a8;
  --gold: #c8955b;
  --rose: #e9a7a5;
  --paper: rgba(255, 255, 255, 0.9);
  --shadow: 0 26px 90px rgba(30, 41, 59, 0.13);
  --field: #ffffff;
  --bg-a: #f8fbff;
  --bg-b: #fff8ef;
  --title-a: #172033;
  --title-b: #477f8a;
  --title-c: #b98763;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  text-decoration: none !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f6fb;
  --muted: #bcc7d8;
  --subtle: #8795aa;
  --faint: rgba(228, 236, 248, 0.08);
  --line: rgba(214, 226, 242, 0.14);
  --blue: #9fb7dd;
  --teal: #9ad2ca;
  --gold: #e6c391;
  --rose: #dfa5ae;
  --paper: rgba(24, 32, 49, 0.7);
  --shadow: 0 32px 120px rgba(0, 0, 0, 0.34);
  --field: rgba(246, 249, 255, 0.075);
  --bg-a: #101625;
  --bg-b: #1a2433;
  --title-a: #fff8ef;
  --title-b: #bddfd9;
  --title-c: #e8c69d;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at 18% 14%, rgba(223, 165, 174, 0.1), transparent 42%),
    radial-gradient(ellipse at 86% 18%, rgba(154, 210, 202, 0.105), transparent 44%),
    radial-gradient(ellipse at 52% 82%, rgba(159, 183, 221, 0.1), transparent 48%),
    linear-gradient(145deg, #0f1523 0%, #182233 48%, #1d2632 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 62% 18%, rgba(255, 255, 255, 0.2), transparent 34%),
    radial-gradient(circle at 16% 8%, color-mix(in srgb, var(--rose) 11%, transparent), transparent 34%),
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--teal) 12%, transparent), transparent 36%),
    linear-gradient(135deg, var(--bg-a) 0%, var(--bg-b) 100%);
  transition: background 0.35s ease, color 0.35s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

body::after {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 72%, rgba(110, 183, 168, 0.09), transparent 36%),
    radial-gradient(ellipse at 74% 30%, rgba(95, 143, 202, 0.08), transparent 38%),
    radial-gradient(ellipse at 48% 48%, rgba(233, 167, 165, 0.065), transparent 42%);
  filter: blur(34px);
  opacity: 0.62;
  animation: ambientHeal 22s ease-in-out infinite alternate;
}

html[data-theme="dark"] body::after {
  opacity: 0.32;
  background:
    radial-gradient(ellipse at 18% 72%, rgba(154, 210, 202, 0.085), transparent 42%),
    radial-gradient(ellipse at 76% 28%, rgba(159, 183, 221, 0.075), transparent 44%),
    radial-gradient(ellipse at 48% 48%, rgba(223, 165, 174, 0.052), transparent 48%);
}

@keyframes ambientHeal {
  from {
    transform: translate3d(-1.8%, 1.2%, 0) scale(1);
  }

  to {
    transform: translate3d(1.6%, -1.4%, 0) scale(1.035);
  }
}

html[data-theme="dark"] body::before {
  opacity: 0.72;
  background-image:
    radial-gradient(circle, rgba(255, 248, 239, 0.62) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(189, 223, 217, 0.42) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(232, 198, 157, 0.32) 0 0.8px, transparent 1.4px),
    linear-gradient(rgba(224, 232, 244, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(224, 232, 244, 0.026) 1px, transparent 1px);
  background-position:
    0 0,
    42px 72px,
    96px 28px,
    0 0,
    0 0;
  background-size:
    210px 210px,
    320px 320px,
    260px 260px,
    44px 44px,
    44px 44px;
  animation: starDrift 26s linear infinite, starBreath 5.6s ease-in-out infinite alternate;
}

@keyframes starDrift {
  to {
    background-position:
      34px 48px,
      78px 118px,
      132px 70px,
      0 0,
      0 0;
  }
}

@keyframes starBreath {
  from {
    opacity: 0.5;
  }

  to {
    opacity: 0.76;
  }
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.icp-link {
  display: block;
  width: fit-content;
  margin-top: -7px;
  margin: -7px auto 0 auto;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  /* padding: 28px 0 42px; */
  position: relative;
  z-index: 1;
}

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  margin-bottom: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.22);
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 17px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.feature-jump {
  border: 1px solid rgba(180, 198, 224, 0.54);
  border-radius: 999px;
  padding: 8px 12px;
  color: #1e3a5f;
  background: rgba(255, 255, 255, 0.64);
  font-weight: 900;
}

.feature-jump {
  color: #fff;
  border: 0;
  background: linear-gradient(135deg, #2f6edc, #35b7a7);
  box-shadow: 0 12px 28px rgba(47, 110, 220, 0.22);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 92px;
  border: 1px solid rgba(185, 199, 219, 0.7);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 30px rgba(30, 41, 59, 0.08);
}

html[data-theme="dark"] .theme-toggle {
  background: rgba(15, 23, 42, 0.58);
}

.theme-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #76a8dc, #78beb1);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #78a9df, #7fc0b4 58%, #d0a071);
  box-shadow: 0 16px 34px rgba(95, 143, 202, 0.22);
}

.btn-soft {
  color: #26415f;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(185, 199, 219, 0.7);
}

html[data-theme="dark"] .btn-soft {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.72);
}

.btn-rose {
  color: #fff;
  background: linear-gradient(135deg, #e85d75, #f97316);
  box-shadow: 0 16px 34px rgba(232, 93, 117, 0.2);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.card {
  background: var(--paper);
  border: 1px solid rgba(223, 231, 241, 0.88);
  border-radius: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

html[data-theme="dark"] .card {
  border-color: rgba(162, 176, 202, 0.18);
}

.login-layout {
  flex: 1;
  min-height: calc(100vh - 84px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  gap: clamp(18px, 4vw, 42px);
  align-items: center;
}

.login-stage {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  --spot-x: 50%;
  --spot-y: 50%;
  min-height: min(62vh, 640px);
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  border-radius: 48px;
  transform: translateZ(0);
  filter: drop-shadow(0 40px 90px rgba(27, 36, 52, 0.13));
}

.login-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at var(--spot-x) var(--spot-y), rgba(255, 255, 255, 0.28), transparent 42%),
    radial-gradient(ellipse at 24% 22%, rgba(233, 167, 165, 0.062), transparent 42%),
    radial-gradient(ellipse at 82% 28%, rgba(95, 143, 202, 0.062), transparent 46%),
    linear-gradient(135deg, rgba(233, 167, 165, 0.028), rgba(95, 143, 202, 0.034), rgba(110, 183, 168, 0.032));
  opacity: 0.78;
  filter: blur(10px);
  animation: softRipple 18s ease-in-out infinite alternate;
  transition: opacity 0.28s ease;
}

.login-stage::after {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 42px;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 22%, rgba(255, 255, 255, 0.2), transparent 34%),
    repeating-radial-gradient(circle at 42% 48%, rgba(37, 99, 235, 0.045) 0 1px, transparent 1px 18px),
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.24);
  opacity: 0.55;
  animation: rippleDrift 24s ease-in-out infinite alternate;
}

html[data-theme="dark"] .login-stage::before {
  background:
    radial-gradient(circle at var(--spot-x) var(--spot-y), rgba(96, 165, 250, 0.11), transparent 44%),
    radial-gradient(ellipse at 24% 22%, rgba(255, 123, 148, 0.07), transparent 44%),
    radial-gradient(ellipse at 82% 28%, rgba(139, 183, 255, 0.08), transparent 48%),
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(15, 118, 110, 0.075));
}

.stage-glass {
  position: absolute;
  inset: clamp(18px, 4vw, 42px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 64px);
  border-radius: 38px;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transform-style: preserve-3d;
  transition: transform 0.16s ease;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.12)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.66));
  border: 1px solid rgba(255, 255, 255, 0.56);
  box-shadow: 0 34px 120px rgba(30, 41, 59, 0.12);
  backdrop-filter: blur(18px);
  z-index: 1;
}

html[data-theme="dark"] .stage-glass {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.2)),
    linear-gradient(180deg, rgba(30, 41, 59, 0.22), rgba(15, 23, 42, 0.82));
  border-color: rgba(255, 255, 255, 0.12);
}

.stage-kicker {
  color: var(--subtle);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.24em;
}

.stage-line {
  width: min(360px, 62%);
  height: 1px;
  margin: 24px 0;
  background: linear-gradient(90deg, rgba(95, 143, 202, 0.74), rgba(110, 183, 168, 0.26), transparent);
}

.stage-slogan {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.72;
  letter-spacing: 0.02em;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(22px);
  opacity: 0.42;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.orb-one {
  width: 220px;
  height: 220px;
  left: 8%;
  top: 11%;
  background: radial-gradient(circle, rgba(233, 167, 165, 0.14), transparent 68%);
}

.orb-two {
  width: 280px;
  height: 280px;
  right: 10%;
  top: 18%;
  animation-delay: -2s;
  background: radial-gradient(circle, rgba(95, 143, 202, 0.13), transparent 68%);
}

.orb-three {
  width: 180px;
  height: 180px;
  right: 22%;
  bottom: 12%;
  animation-delay: -4s;
  background: radial-gradient(circle, rgba(110, 183, 168, 0.13), transparent 68%);
}

@keyframes softRipple {
  from {
    transform: scale(1) translate3d(-8px, 4px, 0);
  }

  to {
    transform: scale(1.035) translate3d(8px, -6px, 0);
  }
}

@keyframes rippleDrift {
  from {
    transform: translate3d(-6px, 4px, 0) scale(0.99);
  }

  to {
    transform: translate3d(8px, -5px, 0) scale(1.02);
  }
}

@keyframes floatOrb {
  from {
    transform: translate3d(-12px, 10px, 0) scale(0.98);
  }

  to {
    transform: translate3d(18px, -18px, 0) scale(1.06);
  }
}

.login-title {
  width: fit-content;
  margin: 14px 0 0;
  font-family: "Songti SC", "STSong", "SimSun", "KaiTi", "Kaiti SC", serif;
  font-size: clamp(74px, 13vw, 148px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.055em;
  color: transparent;
  background:
    linear-gradient(118deg, var(--title-a) 0%, var(--title-a) 42%, var(--title-b) 68%, var(--title-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 22px 46px rgba(18, 28, 45, 0.055);
  filter: drop-shadow(0 14px 30px rgba(71, 127, 138, 0.08));
}

.login-card {
  padding: clamp(24px, 4vw, 38px);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -34%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 28%, rgba(233, 167, 165, 0.066), transparent 36%),
    radial-gradient(ellipse at 78% 24%, rgba(95, 143, 202, 0.07), transparent 38%),
    radial-gradient(ellipse at 62% 84%, rgba(110, 183, 168, 0.065), transparent 42%);
  filter: blur(26px);
  opacity: 0.82;
  animation: cardBreath 20s ease-in-out infinite alternate;
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 26px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.54);
  opacity: 0.8;
}

@keyframes cardBreath {
  from {
    transform: translate3d(-3%, 2%, 0) rotate(-1deg) scale(1);
  }

  to {
    transform: translate3d(3%, -2%, 0) rotate(1deg) scale(1.04);
  }
}

.form {
  position: relative;
  display: grid;
  gap: 18px;
  margin-top: 0;
  z-index: 1;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #d8e2ef;
  border-radius: 18px;
  background: var(--field);
  color: var(--ink);
  outline: none;
  padding: 16px 17px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 48px;
}

.password-wrap input::-ms-reveal,
.password-wrap input::-ms-clear {
  display: none;
}

.password-wrap input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  pointer-events: none;
}

.password-eye {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 30px;
  height: 30px;
  transform: translateY(-50%) scale(0.92);
  border: 0;
  border-radius: 50%;
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.password-eye.visible {
  opacity: 0.72;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

.password-eye:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--faint) 70%, transparent);
  transform: translateY(-50%) scale(1.04);
}

.password-eye:active {
  transform: translateY(-50%) scale(0.96);
}

.password-eye::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  width: 16px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 55% 55% 50% 50%;
  transform: rotate(-4deg);
}

.password-eye::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 14px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transition: width 0.18s ease, height 0.18s ease, transform 0.18s ease, left 0.18s ease, top 0.18s ease;
}

.password-eye[aria-pressed="true"]::after {
  left: 7px;
  top: 15px;
  width: 17px;
  height: 1.5px;
  border-radius: 999px;
  transform: rotate(-35deg);
}

html[data-theme="dark"] .password-eye.visible {
  opacity: 0.62;
}

html[data-theme="dark"] .password-eye:hover {
  background: rgba(255, 255, 255, 0.055);
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.7;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(110, 183, 168, 0.58);
  box-shadow:
    0 0 0 4px rgba(110, 183, 168, 0.075),
    0 12px 28px rgba(95, 143, 202, 0.06);
  transform: none;
}

.agree-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #667085;
  line-height: 1.65;
  font-size: 13px;
}

.agree-line input {
  margin-top: 4px;
}

.agree-line a {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}

.hint {
  color: var(--muted);
  line-height: 1.75;
  font-size: 14px;
}

.form-error {
  min-height: 22px;
  color: #dc2626;
  font-size: 13px;
  line-height: 1.5;
}

.login-submit {
  position: relative;
  min-height: 54px;
  font-weight: 900;
  overflow: hidden;
}

.login-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transition: transform 0.6s ease;
}

.login-submit:not(:disabled):hover::before {
  transform: translateX(100%);
}

.submit-loader {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.login-submit.loading .submit-text {
  display: none;
}

.login-submit.loading .submit-loader {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.chat-layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 22px;
  align-items: stretch;
}

.side-panel,
.chat-panel {
  min-height: 720px;
}

.side-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-title {
  margin: 0;
  font-size: 24px;
}

.role-list {
  display: grid;
  gap: 11px;
  overflow: auto;
  padding-right: 3px;
}

.role-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  text-align: left;
  border: 1px solid #e2eaf4;
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
}

html[data-theme="dark"] .role-card {
  background: rgba(15, 23, 42, 0.88);
}

.role-card.active {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.12);
  background: linear-gradient(135deg, #fff, #f1f8ff);
}

.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  color: #1d4ed8;
  font-weight: 900;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.role-name {
  font-weight: 900;
  margin-bottom: 4px;
}

.role-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.tag {
  padding: 3px 8px;
  border-radius: 999px;
  color: #245a99;
  background: #edf5ff;
  font-size: 12px;
}

.chat-panel {
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--faint) 78%, transparent);
}

.current-role {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.12);
}

.dot.online {
  background: #10b981;
  box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12);
}

.messages {
  min-height: 480px;
  max-height: 620px;
  overflow: auto;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid #e9eff7;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper) 70%, transparent), color-mix(in srgb, var(--paper) 92%, transparent)),
    repeating-linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0 1px, transparent 1px 13px);
}

.msg {
  display: flex;
  margin: 12px 0;
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(78%, 660px);
  padding: 13px 15px;
  border-radius: 20px;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 12px 28px rgba(30, 41, 59, 0.08);
}

.msg.assistant .bubble {
  border-top-left-radius: 8px;
  background: #fff;
  border: 1px solid #e7edf6;
}

html[data-theme="dark"] .msg.assistant .bubble {
  background: rgba(15, 23, 42, 0.9);
}

.msg.user .bubble {
  border-top-right-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
}

.msg.system .bubble {
  max-width: 100%;
  color: #52637a;
  background: var(--faint);
  border: 1px dashed #d8e2ef;
  box-shadow: none;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

.composer textarea {
  min-height: 82px;
}

.send-btn {
  min-width: 122px;
  min-height: 82px;
  border-radius: 24px;
  font-weight: 900;
}

.legal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

.legal-nav {
  padding: 20px;
  position: sticky;
  top: 20px;
  height: fit-content;
}

.legal-nav a {
  display: block;
  padding: 11px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: #344054;
  font-weight: 800;
}

.legal-nav a:hover {
  background: #f2f7ff;
  color: #1d4ed8;
}

.legal-content {
  padding: 30px;
}

.legal-content h1 {
  margin: 0 0 10px;
  font-size: clamp(34px, 5vw, 54px);
  letter-spacing: -0.05em;
}

.legal-content h2 {
  margin: 30px 0 8px;
  font-size: 26px;
}

.legal-content h3 {
  margin: 22px 0 8px;
  font-size: 19px;
}

.legal-content p {
  margin: 0 0 8px;
  color: #344054;
  line-height: 1.88;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.52);
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(86vh, 780px);
  overflow: hidden;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 34px 90px rgba(15, 23, 42, 0.3);
}

html[data-theme="dark"] .modal-card {
  background: #0f172a;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid #edf2f7;
}

.modal-head h2 {
  margin: 0;
}

.modal-body {
  padding: 22px 24px 26px;
  max-height: calc(86vh - 86px);
  overflow: auto;
}

.close-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f2f4f7;
  color: #344054;
  font-size: 22px;
}

.receipt {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  color: #05603a;
  background: #ecfdf3;
  border: 1px solid #abefc6;
  line-height: 1.7;
}

.receipt.show {
  display: block;
}

.footer {
  margin-top: 22px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.8;
}

@media (max-width: 900px) {

  .login-layout,
  .chat-layout,
  .legal-layout,
  .feature-strip {
    grid-template-columns: 1fr;
  }

  .login-page {
    min-height: auto;
  }

  .login-stage {
    min-height: 360px;
    border-radius: 30px;
  }

  .stage-glass {
    inset: 12px;
    padding: 28px;
    border-radius: 26px;
  }

  .login-title {
    font-size: clamp(58px, 20vw, 92px);
  }

  .stage-slogan {
    font-size: 17px;
  }

  .login-visual,
  .side-panel,
  .chat-panel {
    min-height: auto;
  }

  .topbar {
    align-items: center;
    justify-content: flex-end;
    top: 18px;
  }

  .nav {
    justify-content: flex-end;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send-btn {
    min-height: 56px;
    width: 100%;
  }

  .messages {
    max-height: 56vh;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 18px, 1180px);
    padding-top: 16px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 15px;
  }

  .theme-toggle {
    min-width: auto;
    padding: 8px 10px;
  }

  .theme-text {
    display: none;
  }

  .login-card {
    border-radius: 28px;
  }
}

/* Chat application shell */
.chat-app-page {
  width: min(1420px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  position: relative;
  z-index: 1;
  transition: grid-template-columns 0.26s ease;
}

.chat-app-page.sidebar-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.app-sidebar,
.app-main {
  min-height: calc(100vh - 36px);
  border: 1px solid rgba(223, 231, 241, 0.78);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  border-radius: 30px;
  padding: 14px;
  transition: width 0.26s ease, padding 0.26s ease;
}

.app-sidebar.collapsed {
  width: 78px;
  padding: 14px 10px;
}

.sidebar-top,
.section-head,
.app-header,
.header-actions,
.current-role {
  display: flex;
  align-items: center;
}

.sidebar-top {
  justify-content: space-between;
  gap: 10px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-brand strong {
  white-space: nowrap;
}

.icon-btn,
.mini-btn,
.pill-btn,
.user-avatar {
  border: 0;
  color: var(--ink);
  background: color-mix(in srgb, var(--faint) 72%, transparent);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
}

.icon-btn span,
.mobile-sidebar-toggle span {
  width: 17px;
  height: 12px;
  display: block;
  position: relative;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.icon-btn span::after,
.mobile-sidebar-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 17px;
  border-top: 2px solid currentColor;
}

.icon-btn:hover,
.mini-btn:hover,
.pill-btn:hover,
.user-avatar:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--faint) 95%, transparent);
}

.mini-btn,
.pill-btn {
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
}

.sidebar-section {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}

.sidebar-roles {
  flex: 1 1 auto;
}

.sidebar-history {
  flex: 0 0 38%;
  min-height: 190px;
}

.section-head {
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.history-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.history-item {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 11px 12px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}

.history-item:hover,
.role-card:hover {
  background: color-mix(in srgb, var(--faint) 70%, transparent);
}

.history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.history-item small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-brand strong,
.app-sidebar.collapsed .section-head span,
.app-sidebar.collapsed .mini-btn,
.app-sidebar.collapsed .role-card-body,
.app-sidebar.collapsed .history-item small,
.app-sidebar.collapsed .history-item span {
  display: none;
}

.app-sidebar.collapsed .sidebar-top,
.app-sidebar.collapsed .section-head {
  justify-content: center;
}

.app-sidebar.collapsed .role-card {
  grid-template-columns: 48px;
  justify-content: center;
  padding: 8px;
}

.app-sidebar.collapsed .history-item {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 15px;
  background:
    linear-gradient(var(--ink), var(--ink)) center 14px / 16px 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center 22px / 16px 2px no-repeat,
    color-mix(in srgb, var(--faint) 70%, transparent);
  opacity: 0.48;
}

.app-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 34px;
  padding: 20px;
}

.app-header {
  justify-content: space-between;
  gap: 16px;
  padding: 10px;
  border-radius: 26px;
  background: color-mix(in srgb, var(--faint) 62%, transparent);
}

.role-meta {
  min-width: 0;
}

.header-actions {
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-toggle.compact {
  min-width: 94px;
  padding: 8px 11px;
}

.user-menu-wrap {
  position: relative;
}

.user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #78a9df, #7fc0b4);
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  width: 220px;
  display: none;
  padding: 8px;
  border: 1px solid rgba(223, 231, 241, 0.84);
  border-radius: 20px;
  background: color-mix(in srgb, var(--paper) 96%, transparent);
  box-shadow: 0 24px 70px rgba(30, 41, 59, 0.18);
  backdrop-filter: blur(18px);
}

.user-menu.show {
  display: block;
}

.user-menu-name {
  padding: 10px 11px;
  color: var(--muted);
  font-weight: 900;
}

.user-menu button,
.user-menu a {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 14px;
  padding: 10px 11px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  background: transparent;
}

.user-menu button:hover,
.user-menu a:hover {
  background: color-mix(in srgb, var(--faint) 78%, transparent);
}

.chat-shell {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  padding-top: 16px;
}

.chat-app-page .messages {
  min-height: 0;
  max-height: none;
  border-radius: 30px;
}

.chat-app-page .composer {
  grid-template-columns: minmax(0, 1fr) 128px;
  padding: 10px;
  border: 1px solid rgba(223, 231, 241, 0.78);
  border-radius: 28px;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
}

.chat-app-page .composer textarea {
  min-height: 74px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.chat-app-page .send-btn {
  min-height: 74px;
}

.chat-footer {
  padding-top: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.compact-modal {
  width: min(520px, 100%);
}

html[data-theme="dark"] .app-sidebar,
html[data-theme="dark"] .app-main,
html[data-theme="dark"] .user-menu {
  border-color: rgba(214, 226, 242, 0.12);
}

html[data-theme="dark"] .role-card.active {
  background: linear-gradient(135deg, rgba(159, 183, 221, 0.18), rgba(154, 210, 202, 0.1));
}

@media (max-width: 980px) {
  .chat-app-page {
    width: min(100% - 18px, 1420px);
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    top: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 30;
    width: min(320px, calc(100vw - 20px));
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.26s ease;
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-sidebar-toggle {
    display: grid;
  }

  .app-main {
    min-height: calc(100vh - 28px);
  }

  .header-actions {
    gap: 7px;
  }
}

@media (min-width: 981px) {
  .mobile-sidebar-toggle {
    display: none;
  }
}

@media (max-width: 620px) {
  .app-main {
    padding: 12px;
    border-radius: 24px;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .chat-app-page .composer {
    grid-template-columns: 1fr;
  }

  .chat-app-page .send-btn {
    width: 100%;
    min-height: 52px;
  }
}

/* Refined chat page: app-like, fixed viewport, role conversations separated. */
.chat-body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.chat-body .chat-app-page {
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  margin: 0;
  padding: 0;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 0;
  transition: none;
}

.chat-body .chat-app-page.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.chat-body .app-sidebar,
.chat-body .app-main {
  min-height: 0;
  height: 100vh;
  border-top: 0;
  border-bottom: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-body .app-sidebar {
  border-left: 0;
  border-radius: 0;
  border-color: rgba(203, 213, 225, 0.52);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  padding: 14px 12px;
}

.chat-body .app-sidebar.collapsed {
  width: auto;
  padding: 14px 10px;
}

.chat-body .app-main {
  position: relative;
  isolation: isolate;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 68% 8%, rgba(110, 183, 168, 0.075), transparent 30%),
    radial-gradient(ellipse at 38% 88%, rgba(233, 167, 165, 0.07), transparent 36%),
    color-mix(in srgb, var(--paper) 64%, transparent);
  padding: 0;
}

.chat-body .app-main::before {
  content: "";
  grid-row: 2 / 4;
  grid-column: 1;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(248, 251, 255, 0.98) 0%, rgba(248, 251, 255, 0.94) 26%, rgba(248, 251, 255, 0.64) 46%, rgba(248, 251, 255, 0.18) 68%, rgba(248, 251, 255, 0) 100%),
    url("./assets/anime-chat-bg.png") 78% center / cover no-repeat;
  opacity: 0.62;
}

.chat-body .app-main>* {
  grid-column: 1;
  position: relative;
  z-index: 1;
}

.chat-body .app-header {
  grid-row: 1;
}

.chat-body .chat-shell {
  grid-row: 2;
}

.chat-body .chat-footer {
  grid-row: 3;
}

.chat-body .sidebar-top {
  min-height: 46px;
  margin-bottom: 4px;
}

.quiet-action {
  min-width: 0;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--faint) 62%, transparent);
  font-weight: 900;
}

.quiet-action:hover {
  background: color-mix(in srgb, var(--faint) 88%, transparent);
}

.chat-body .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 15px;
}

.chat-body .sidebar-toggle {
  order: 1;
}

.chat-body .quiet-action {
  order: 2;
  flex: 1;
}

.chat-body .sidebar-section {
  min-height: 0;
}

.chat-body .sidebar-roles {
  flex: 1 1 auto;
}

.chat-body .sidebar-history {
  flex: 0 0 32%;
  min-height: 150px;
  border-top: 1px solid rgba(203, 213, 225, 0.36);
  padding-top: 12px;
}

.chat-body .section-head {
  min-height: 32px;
  color: color-mix(in srgb, var(--muted) 86%, transparent);
  letter-spacing: 0.02em;
}

.chat-body .mini-btn,
.chat-body .pill-btn {
  padding: 7px 11px;
  background: color-mix(in srgb, var(--faint) 58%, transparent);
}

.chat-body .role-list {
  align-content: start;
  gap: 6px;
  overflow: auto;
  padding: 4px 2px 8px 0;
}

.chat-body .role-card {
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  padding: 8px;
  background: transparent;
  box-shadow: none;
}

.chat-body .role-card.active {
  border: 0;
  background: color-mix(in srgb, var(--faint) 82%, transparent);
  box-shadow: inset 3px 0 0 rgba(110, 183, 168, 0.62);
}

.chat-body .avatar {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: linear-gradient(135deg, #dff4f1, #e8f0ff);
}

.chat-body .role-card .avatar {
  width: 44px;
  height: 44px;
}

.chat-body .role-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.chat-body .role-desc {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
}

.chat-body .tag-row {
  margin-top: 5px;
}

.chat-body .tag {
  padding: 2px 7px;
  font-size: 11px;
}

.chat-body .history-list {
  align-content: start;
  gap: 4px;
  overflow: auto;
}

.chat-body .history-item {
  border-radius: 13px;
  padding: 9px 10px;
}

.chat-body .app-sidebar.collapsed .sidebar-brand {
  justify-content: center;
}

.chat-body .app-sidebar.collapsed .sidebar-top {
  flex-direction: column;
  justify-content: flex-start;
}

.chat-body .app-sidebar.collapsed .sidebar-toggle {
  order: 1;
}

.chat-body .app-sidebar.collapsed .quiet-action {
  order: 2;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 0;
}

.chat-body .app-sidebar.collapsed .quiet-action::before {
  content: "+";
  font-size: 24px;
  line-height: 1;
}

.chat-body .app-sidebar.collapsed .sidebar-history {
  display: none;
}

.chat-body .app-sidebar.collapsed .sidebar-roles {
  flex: 1;
}

.chat-body .app-sidebar.collapsed .role-list {
  gap: 10px;
  padding: 8px 0;
  overflow-x: hidden;
  scrollbar-width: none;
}

.chat-body .app-sidebar.collapsed .role-list::-webkit-scrollbar {
  display: none;
}

.chat-body .app-sidebar.collapsed .role-card {
  width: 52px;
  min-height: 52px;
  margin: 0 auto;
  padding: 4px;
  border-radius: 18px;
  background: transparent;
  box-shadow: none;
}

.chat-body .app-sidebar.collapsed .role-card.active {
  background: color-mix(in srgb, var(--faint) 78%, transparent);
  box-shadow: inset 0 0 0 1px rgba(110, 183, 168, 0.48);
}

.chat-body .app-sidebar.collapsed .role-card .avatar {
  width: 44px;
  height: 44px;
}

.chat-body .app-header {
  height: 72px;
  flex: 0 0 auto;
  border-radius: 0;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.36);
  background: color-mix(in srgb, var(--paper) 74%, transparent);
  backdrop-filter: none;
}

.chat-body .current-role {
  min-width: 0;
  gap: 12px;
}

.chat-body .header-actions {
  flex-wrap: nowrap;
}

.chat-body .chat-shell {
  width: min(100%, 980px);
  min-height: 0;
  height: calc(100vh - 118px);
  margin: 0 auto;
  padding: 22px 18px 0;
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-body .messages {
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  padding: 26px 8px 18px;
  background: transparent;
  box-shadow: none;
}

.chat-body .msg {
  margin: 16px 0;
}

.chat-body .bubble {
  max-width: min(76%, 720px);
  border-radius: 22px;
  box-shadow: none;
}

.chat-body .msg.assistant .bubble {
  background: color-mix(in srgb, var(--faint) 66%, transparent);
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
}

.chat-body .msg.system .bubble {
  color: var(--muted);
  background: transparent;
  border: 0;
  padding-left: 0;
}

.chat-body .composer {
  width: min(100%, 900px);
  margin: 0 auto 14px;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: end;
  gap: 8px;
  padding: 8px;
  border-radius: 30px;
  border: 1px solid rgba(203, 213, 225, 0.64);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  box-shadow: 0 18px 60px rgba(30, 41, 59, 0.12);
  backdrop-filter: none;
}

.chat-body .composer textarea {
  min-height: 28px;
  max-height: 148px;
  padding: 12px 14px;
  line-height: 1.65;
}

.chat-body .send-btn {
  width: 54px;
  min-width: 54px;
  min-height: 54px;
  border-radius: 50%;
  padding: 0;
  font-size: 0;
}

.chat-body .send-btn::after {
  content: "➤";
  display: block;
  font-size: 22px;
  transform: translateX(1px) rotate(-8deg);
}

.chat-body .chat-footer {
  height: 62px;
  padding: 0 12px 12px;
  line-height: 34px;
  text-align: center;
}

/* .chat-body .icp-link {
  display: block;
  width: fit-content;
  margin-top: -7px;
  margin: -7px auto 0 auto;
} */

.eyebrow {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

html[data-theme="dark"] .chat-body .app-sidebar {
  background: rgba(8, 11, 18, 0.94);
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .chat-body .app-main {
  background:
    radial-gradient(ellipse at 70% 8%, rgba(154, 210, 202, 0.08), transparent 30%),
    radial-gradient(ellipse at 38% 88%, rgba(223, 165, 174, 0.052), transparent 36%),
    #050608;
}

html[data-theme="dark"] .chat-body .app-header {
  background: rgba(5, 6, 8, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .chat-body .composer {
  background: rgba(35, 35, 35, 0.96);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.36);
}

.chat-body .compact-modal textarea {
  min-height: 92px;
}

html[data-theme="dark"] .chat-body .msg.assistant .bubble {
  background: #1f1f1f;
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .chat-body .msg.system .bubble {
  color: rgba(255, 255, 255, 0.58);
}

html[data-theme="dark"] .chat-body .role-card.active,
html[data-theme="dark"] .chat-body .role-card:hover,
html[data-theme="dark"] .chat-body .history-item:hover {
  background: rgba(255, 255, 255, 0.09);
}

html[data-theme="dark"] .chat-body .avatar {
  background: linear-gradient(135deg, rgba(154, 210, 202, 0.2), rgba(159, 183, 221, 0.18));
}

.recording-page {
  min-height: 100vh;
  color: #0f172a;
  background:
    radial-gradient(circle at 78% 12%, rgba(45, 126, 255, 0.20), transparent 32%),
    radial-gradient(circle at 20% 86%, rgba(52, 211, 153, 0.16), transparent 34%),
    linear-gradient(135deg, #f9fcff 0%, #edf5ff 54%, #f8fbff 100%);
}

.recording-shell {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.recording-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 86px;
}

.recording-nav nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  color: #475569;
  font-weight: 900;
}

.recording-nav .nav-cta {
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #2f6edc, #35b7a7);
  box-shadow: 0 12px 28px rgba(47, 110, 220, 0.18);
}

.recording-hero {
  min-height: calc(100vh - 120px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 44%);
  gap: clamp(24px, 5vw, 68px);
  align-items: center;
  padding: 34px 0 72px;
}

.recording-copy h1 {
  max-width: 760px;
  margin: 14px 0 18px;
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1.02;
  letter-spacing: 0;
}

.recording-copy p {
  max-width: 700px;
  margin: 0;
  color: #526174;
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.recording-visual {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  border-radius: 42px;
  background: rgba(255, 255, 255, 0.38);
  box-shadow: 0 34px 120px rgba(37, 99, 235, 0.16);
}

.recording-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% center;
  opacity: 0.92;
}

.recording-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(248, 251, 255, 0.28) 78%, rgba(248, 251, 255, 0.82) 100%);
}

.sound-panel {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 28px;
  z-index: 2;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(18px);
}

.sound-panel span {
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2f6edc, #35b7a7);
}

.sound-panel span:nth-child(1) {
  height: 34px;
}

.sound-panel span:nth-child(2) {
  height: 58px;
}

.sound-panel span:nth-child(3) {
  height: 76px;
}

.sound-panel span:nth-child(4) {
  height: 48px;
}

.sound-panel span:nth-child(5) {
  height: 62px;
}

.recording-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(148, 163, 184, 0.32);
  border-bottom: 1px solid rgba(148, 163, 184, 0.32);
}

.recording-strip div {
  min-height: 150px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border-right: 1px solid rgba(148, 163, 184, 0.26);
}

.recording-strip div:last-child {
  border-right: 0;
}

.recording-strip strong {
  font-size: 24px;
}

.recording-strip span {
  color: #64748b;
  line-height: 1.65;
}

.recording-flow,
.recording-security {
  padding: clamp(56px, 8vw, 96px) 0;
}

.section-title {
  display: grid;
  gap: 12px;
  margin-bottom: 34px;
}

.section-title h2,
.recording-security h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.08;
}

.recording-flow ol {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(148, 163, 184, 0.32);
}

.recording-flow li {
  display: grid;
  grid-template-columns: 90px minmax(180px, 280px) minmax(0, 1fr);
  gap: 24px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.32);
}

.recording-flow li span {
  color: #2f6edc;
  font-weight: 900;
}

.recording-flow h3 {
  margin: 0;
  font-size: 24px;
}

.recording-flow p,
.recording-security p {
  margin: 0;
  color: #526174;
  font-size: 17px;
  line-height: 1.85;
}

.recording-security {
  display: grid;
  grid-template-columns: minmax(240px, 460px) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: start;
  border-top: 1px solid rgba(148, 163, 184, 0.32);
}

.recording-page .site-icp {
  padding-bottom: 34px;
}

@media (max-width: 900px) {

  .recording-hero,
  .recording-security {
    grid-template-columns: 1fr;
  }

  .recording-visual {
    min-height: 420px;
  }

  .recording-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recording-flow li {
    grid-template-columns: 64px 1fr;
  }

  .recording-flow li p {
    grid-column: 2;
  }
}

@media (max-width: 620px) {
  .recording-shell {
    width: min(100% - 20px, 1200px);
  }

  .recording-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .recording-strip,
  .recording-flow li {
    grid-template-columns: 1fr;
  }

  .recording-flow li p {
    grid-column: auto;
  }
}

@media (max-width: 980px) {
  .chat-body .chat-app-page {
    grid-template-columns: 1fr;
  }

  .chat-body .app-sidebar {
    height: auto;
  }
}

@media (max-width: 620px) {
  .chat-body .app-header {
    height: auto;
    min-height: 72px;
  }

  .chat-body .role-meta {
    max-width: calc(100vw - 126px);
  }

  .chat-body .chat-shell {
    height: calc(100vh - 158px);
    padding: 14px 10px 0;
  }

  .chat-body .bubble {
    max-width: 88%;
  }

  .chat-body .theme-text,
  .chat-body .pill-btn {
    display: none;
  }
}

/* Final H5 polish: deploy-friendly chat surface and complete dark-mode contrast. */
.chat-body .app-sidebar {
  contain: layout paint;
}

.chat-body .messages,
.chat-body .role-list,
.chat-body .history-list {
  overscroll-behavior: contain;
}

.chat-body .chat-footer {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.chat-body .field label,
.chat-body .modal-head h2,
.chat-body .role-name,
.chat-body .history-title,
.chat-body .user-menu-name {
  color: var(--ink);
}

.chat-body .field input,
.chat-body .field textarea,
.chat-body .field select,
.chat-body .composer textarea {
  color: var(--ink);
  caret-color: var(--blue);
}

.chat-body .send-btn::after {
  content: ">";
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 24px;
  font-weight: 900;
  transform: translateX(1px);
}

html[data-theme="dark"] .chat-body .app-sidebar,
html[data-theme="dark"] .chat-body .app-header,
html[data-theme="dark"] .chat-body .modal-card,
html[data-theme="dark"] .chat-body .user-menu {
  color: var(--ink);
}

html[data-theme="dark"] .chat-body .modal-card {
  background:
    radial-gradient(circle at 16% 0%, rgba(154, 210, 202, 0.08), transparent 38%),
    #101827;
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .chat-body .modal-head {
  border-color: rgba(255, 255, 255, 0.11);
}

html[data-theme="dark"] .chat-body .field label,
html[data-theme="dark"] .chat-body .modal-head h2,
html[data-theme="dark"] .chat-body .role-name,
html[data-theme="dark"] .chat-body .history-title,
html[data-theme="dark"] .chat-body .user-menu-name,
html[data-theme="dark"] .chat-body .current-role .role-name {
  color: rgba(248, 250, 252, 0.96);
}

html[data-theme="dark"] .chat-body .role-desc,
html[data-theme="dark"] .chat-body .section-head,
html[data-theme="dark"] .chat-body .history-preview,
html[data-theme="dark"] .chat-body .chat-footer,
html[data-theme="dark"] .chat-body .current-role .role-desc,
html[data-theme="dark"] .chat-body .user-menu button,
html[data-theme="dark"] .chat-body .user-menu a {
  color: rgba(211, 220, 233, 0.72);
}

html[data-theme="dark"] .chat-body .field input,
html[data-theme="dark"] .chat-body .field textarea,
html[data-theme="dark"] .chat-body .field select,
html[data-theme="dark"] .chat-body .composer textarea {
  color: rgba(248, 250, 252, 0.96);
  background: rgba(16, 24, 39, 0.82);
  border-color: rgba(226, 232, 240, 0.18);
}

html[data-theme="dark"] .chat-body .field input::placeholder,
html[data-theme="dark"] .chat-body .field textarea::placeholder,
html[data-theme="dark"] .chat-body .composer textarea::placeholder {
  color: rgba(211, 220, 233, 0.42);
}

html[data-theme="dark"] .chat-body .quiet-action,
html[data-theme="dark"] .chat-body .pill-btn,
html[data-theme="dark"] .chat-body .mini-btn,
html[data-theme="dark"] .chat-body .close-btn,
html[data-theme="dark"] .chat-body .history-item,
html[data-theme="dark"] .chat-body .role-card,
html[data-theme="dark"] .chat-body .user-avatar {
  color: rgba(248, 250, 252, 0.9);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.11);
}

html[data-theme="dark"] .chat-body .user-menu {
  background: rgba(17, 24, 39, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .chat-body .user-menu button:hover,
html[data-theme="dark"] .chat-body .user-menu a:hover {
  color: rgba(248, 250, 252, 0.98);
  background: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .chat-body .receipt {
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.28);
  border-color: rgba(74, 222, 128, 0.22);
}

html[data-theme="dark"] .chat-body .msg.user .bubble {
  color: #07111f;
}

/* Performance pass for the deployable chat page. Keep the calm look, cut expensive repaint work. */
.chat-body::before,
.chat-body::after {
  animation: none;
  filter: none;
  transform: none;
}

.chat-body::before {
  opacity: 0.22;
}

.chat-body::after {
  opacity: 0.16;
}

.chat-body .chat-app-page {
  contain: size layout style;
}

.chat-body .app-main,
.chat-body .app-sidebar,
.chat-body .app-header,
.chat-body .composer,
.chat-body .messages,
.chat-body .modal-card,
.chat-body .user-menu {
  will-change: auto;
  backface-visibility: hidden;
}

.chat-body .messages {
  contain: layout paint;
  scroll-behavior: auto;
}

.chat-body .msg {
  contain: layout paint;
}

.chat-body .role-card,
.chat-body .history-item,
.chat-body .quiet-action,
.chat-body .mini-btn,
.chat-body .pill-btn,
.chat-body .user-avatar {
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}

.chat-body .role-card:hover,
.chat-body .history-item:hover,
.chat-body .quiet-action:hover,
.chat-body .mini-btn:hover,
.chat-body .pill-btn:hover,
.chat-body .user-avatar:hover {
  transform: none;
  box-shadow: none;
}

.chat-body .composer {
  box-shadow: 0 10px 30px rgba(30, 41, 59, 0.08);
}

.chat-body .modal-card {
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.22);
}

.chat-body .user-menu {
  box-shadow: 0 14px 38px rgba(30, 41, 59, 0.14);
}

html[data-theme="dark"] .chat-body .composer {
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .chat-body .user-menu {
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {

  .chat-body *,
  .chat-body *::before,
  .chat-body *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}