:root {
  --bg: #07131f;
  --panel: rgba(7, 25, 38, 0.86);
  --line: rgba(171, 225, 255, 0.15);
  --text: #ebf7ff;
  --muted: #99bdd0;
  --accent: #ff8f46;
  --teal: #1fc6a3;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 198, 163, 0.22), transparent 26%),
    radial-gradient(circle at bottom right, rgba(255, 143, 70, 0.24), transparent 34%),
    linear-gradient(135deg, #030b12 0%, #0b2131 46%, #101a26 100%);
  color: var(--text);
}

body.theme-light {
  background:
    radial-gradient(circle at top left, rgba(31, 198, 163, 0.18), transparent 26%),
    radial-gradient(circle at bottom right, rgba(255, 143, 70, 0.18), transparent 34%),
    linear-gradient(135deg, #f6fbff 0%, #dbeef8 46%, #eef7fb 100%);
  color: #112532;
}

body.theme-light .app {
  background: rgba(255, 255, 255, 0.82);
}

body.theme-light .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(247, 252, 255, 0.92));
}

body.theme-light .account-card,
body.theme-light .info-card,
body.theme-light .message.meta,
body.theme-light .ghost-btn,
body.theme-light input,
body.theme-light textarea,
body.theme-light .chat-item,
body.theme-light .brand-chip,
body.theme-light .endpoint-chip,
body.theme-light .domain-chip,
body.theme-light .voice-pill {
  background: rgba(17, 37, 50, 0.05);
  color: #173243;
}

body.theme-light .lead,
body.theme-light .status-text,
body.theme-light .privacy-card,
body.theme-light .chat-item small,
body.theme-light .app-credit,
body.theme-light .topbar p {
  color: #557383;
}

body.theme-dark {
  background:
    radial-gradient(circle at top left, rgba(98, 60, 255, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(0, 184, 148, 0.16), transparent 32%),
    linear-gradient(135deg, #02050d 0%, #090f1e 46%, #141625 100%);
}

.page-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.app {
  width: min(1220px, 100%);
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 370px 1fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 42px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(1, 12, 18, 0.28);
}

.brand-chip,
.endpoint-chip,
.domain-chip,
.voice-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.92rem;
}

.brand-title {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 3.7rem);
  line-height: 0.93;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.brand-title span {
  display: block;
  color: var(--accent);
}

.lead {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.account-card,
.info-card {
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 20px;
}

.account-card strong,
.info-card strong {
  display: block;
  margin-bottom: 10px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.auth-tab.active {
  color: #10222c;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #ffd277);
}

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

.hidden {
  display: none !important;
}

label {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(31, 198, 163, 0.72);
  box-shadow: 0 0 0 4px rgba(31, 198, 163, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.chat-item {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.chat-item:hover {
  transform: translateY(-1px);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  padding: 14px 18px;
  border-radius: 999px;
}

.primary-btn {
  color: #10222c;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #ffd277);
  box-shadow: 0 12px 28px rgba(255, 143, 70, 0.24);
}

.secondary-btn {
  color: #08251d;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal), #8ef6d8);
}

.ghost-btn {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-text {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.chat-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.chat-item {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-item span,
.chat-item small {
  display: block;
}

.chat-item small {
  margin-top: 6px;
  color: var(--muted);
}

.chat-item.active-chat-item {
  background: linear-gradient(135deg, rgba(31, 198, 163, 0.18), rgba(180, 255, 232, 0.08));
  border-color: rgba(31, 198, 163, 0.3);
}

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - 48px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 26px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0;
  font-size: 1.6rem;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 620px;
}

.topbar-actions,
.composer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-pill {
  background: rgba(31, 198, 163, 0.11);
  color: #b4ffe8;
  border-color: rgba(31, 198, 163, 0.22);
}

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

.message {
  max-width: min(74%, 680px);
  padding: 16px 18px;
  border-radius: 26px;
  line-height: 1.65;
  white-space: pre-wrap;
  animation: rise 0.26s ease;
}

.message.user {
  align-self: flex-end;
  color: #10222c;
  background: linear-gradient(135deg, var(--accent), #ffd277);
  border-bottom-right-radius: 12px;
}

.message.bot {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(31, 198, 163, 0.18), rgba(180, 255, 232, 0.08));
  border: 1px solid rgba(31, 198, 163, 0.24);
  border-bottom-left-radius: 12px;
}

.message.meta {
  align-self: center;
  max-width: 90%;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.composer {
  padding: 18px 28px 28px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
}

.composer textarea {
  min-height: 110px;
  resize: vertical;
}

.privacy-card {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.94rem;
}

.settings-panel {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.policy-link {
  display: inline-block;
  margin-right: 14px;
  color: #ccefff;
  text-decoration: none;
  font-weight: 700;
}

.policy-link:hover {
  color: white;
}

.app-credit {
  text-align: right;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 12px;
  }

  .app {
    border-radius: 28px;
    min-height: calc(100vh - 24px);
  }

  .sidebar,
  .topbar,
  .messages,
  .composer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .message {
    max-width: 88%;
  }
}
