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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--color-midnight-slate);
  color: var(--color-ghost-white);
  font-family: var(--font-test-untitled-sans);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -45% -25%;
  background: var(--gradient-cosmic-gradient);
  opacity: 0.14;
  filter: blur(140px);
  transform: rotate(-10deg);
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.12;
  pointer-events: none;
  z-index: -1;
  mask-image: radial-gradient(circle at 72% 30%, black 0%, black 28%, transparent 72%);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 0;
  backdrop-filter: blur(14px);
  background: rgba(22, 30, 41, 0.30);
}

.topbar__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.topbar__pill {
  width: min(920px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-full-4);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
}

.brand__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--gradient-cosmic-gradient);
  box-shadow: 0 0 26px rgba(233, 179, 242, 0.28);
}

.brand__text {
  font-family: var(--font-inter);
  font-weight: var(--font-weight-medium);
  font-size: 14px;
  color: var(--color-ghost-white);
  letter-spacing: -0.2px;
}

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

.nav__link {
  font-family: var(--font-inter);
  font-weight: var(--font-weight-medium);
  font-size: 14px;
  color: var(--color-faded-steel);
  padding: 7px 10px;
  border-radius: var(--radius-full);
  transition: color 120ms ease, background 120ms ease;
}

.nav__link:hover {
  color: var(--color-ghost-white);
  background: rgba(255, 255, 255, 0.05);
}

.nav__link--active {
  color: var(--color-ghost-white);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav__form {
  margin: 0;
}

.nav__link--button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 54px 18px 80px;
}

.shell--narrow {
  max-width: 720px;
}

.hero {
  position: relative;
  border-radius: var(--radius-3xl);
  padding: 70px 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.16);
}

.hero__bg {
  position: absolute;
  inset: -30%;
  background: var(--gradient-cosmic-gradient);
  opacity: 0.20;
  filter: blur(80px);
  transform: rotate(-10deg);
}

.hero__content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: grid;
  justify-items: center;
}

.hero__title {
  margin: 0 0 14px;
  font-size: clamp(42px, 5.6vw, var(--text-display));
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  max-width: 18ch;
}

.hero__subtitle {
  margin: 0;
  max-width: 62ch;
  color: var(--color-faded-steel);
  font-size: 16px;
  line-height: var(--leading-body);
}

@media (max-width: 540px) {
  body::after {
    opacity: 0.08;
    mask-image: none;
  }
  .hero {
    padding: 56px 18px;
  }
  .hero__title {
    letter-spacing: var(--tracking-heading-lg);
    line-height: var(--leading-heading-lg);
    max-width: 20ch;
  }
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

@media (min-width: 980px) {
  .grid {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
  .grid--stack {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  border-radius: var(--radius-cards);
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: var(--card-padding);
  backdrop-filter: blur(10px);
}

.card__header {
  margin-bottom: 12px;
}

.card__title {
  margin: 0;
  font-size: 24px;
  line-height: var(--leading-heading-sm);
  letter-spacing: var(--tracking-heading-sm);
}

.card__meta {
  margin: 6px 0 0;
  color: var(--color-faded-steel);
  font-size: 14px;
  line-height: var(--leading-body-sm);
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: rgba(255, 255, 255, 0.08);
}

.form {
  display: grid;
  gap: 10px;
}

.form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form__help {
  min-height: 18px;
  font-size: 13px;
  color: var(--color-faded-steel);
}

.input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  border-radius: var(--radius-formfields);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(22, 30, 41, 0.55);
  color: var(--color-ghost-white);
  outline: none;
}

.input:focus {
  border-color: rgba(233, 179, 242, 0.55);
  box-shadow: 0 0 0 3px rgba(233, 179, 242, 0.15);
}

.btn {
  border-radius: var(--radius-buttons);
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-ghost-white);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border 120ms ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--color-ghost-white);
  color: var(--color-deep-space-black);
  border-color: rgba(0, 0, 0, 0.32);
}

.btn--primary:hover {
  background: rgba(254, 252, 251, 0.92);
}

.btn--ghost {
  background: transparent;
}

.btn--danger {
  border-color: rgba(255, 86, 86, 0.35);
  background: rgba(255, 86, 86, 0.10);
}

.alert {
  border-radius: var(--radius-xl);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  margin-top: 14px;
}

.alert--danger {
  border-color: rgba(255, 86, 86, 0.35);
  background: rgba(255, 86, 86, 0.10);
}

.kb__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kb__title {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.2px;
}

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

.kb__item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(22, 30, 41, 0.35);
}

.kb__name {
  font-size: 14px;
  color: var(--color-ghost-white);
}

.kb__meta {
  font-size: 12px;
  color: var(--color-faded-steel);
}

.chat__log {
  height: 260px;
  overflow: auto;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(22, 30, 41, 0.35);
  padding: 12px;
}

.msg {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.msg__role {
  font-family: var(--font-inter);
  font-size: 12px;
  color: var(--color-faded-steel);
}

.msg__bubble {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  white-space: pre-wrap;
  word-break: break-word;
}

.chat__controls {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

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

.chat__row--split {
  justify-content: space-between;
}

.chip {
  padding: 6px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--color-faded-steel);
  font-family: var(--font-inter);
  font-size: 12px;
}

.audio {
  width: 100%;
}

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

@media (min-width: 780px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat {
  padding: 12px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(22, 30, 41, 0.35);
}

.stat__label {
  font-size: 12px;
  color: var(--color-faded-steel);
  margin-bottom: 6px;
}

.stat__value {
  font-size: 22px;
  letter-spacing: -0.4px;
}

.empty {
  padding: 10px 12px;
  border-radius: var(--radius-xl);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--color-faded-steel);
}

.table {
  display: grid;
  gap: 8px;
}

.table__head,
.table__row {
  display: grid;
  grid-template-columns: 1.6fr 0.6fr 0.9fr 0.6fr;
  gap: 10px;
  align-items: center;
}

.table__head {
  font-size: 12px;
  color: var(--color-faded-steel);
  padding: 0 6px;
}

.table__row {
  padding: 10px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(22, 30, 41, 0.35);
}

.table__cell--right {
  text-align: right;
}

.mono-list {
  display: grid;
  gap: 8px;
}

.mono-list__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(22, 30, 41, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.mono-list__pill {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.mono-list__dim {
  color: rgba(184, 185, 188, 0.9);
}
