:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: rgba(19, 25, 34, 0.78);
  --panel-strong: rgba(25, 34, 47, 0.92);
  --line: rgba(255, 255, 255, 0.11);
  --text: #eef5ff;
  --muted: #93a4ba;
  --blue: #50b8ff;
  --green: #54e39e;
  --red: #ff6978;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(80, 184, 255, 0.22), transparent 32rem),
    radial-gradient(circle at 82% 15%, rgba(84, 227, 158, 0.14), transparent 28rem),
    linear-gradient(145deg, #080b10 0%, #111823 48%, #090d13 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  color: #061016;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, filter 180ms ease, opacity 180ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.hidden {
  display: none !important;
}

.auth-panel,
.messenger {
  width: 100%;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(18, 26, 38, 0.86), rgba(12, 17, 25, 0.78));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.auth-panel {
  max-width: 650px;
  border-radius: 8px;
  padding: clamp(26px, 5vw, 54px);
}

.brand,
.profile,
.chat-head,
.head-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 18px;
}

.mark,
.avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #061016;
  font-weight: 900;
}

.eyebrow,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 {
  margin-top: 6px;
  font-size: clamp(2rem, 6vw, 4.3rem);
}

h2 {
  margin-top: 5px;
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.lead {
  max-width: 560px;
  color: #c9d7e7;
  font-size: 1.08rem;
  line-height: 1.65;
  margin: 30px 0;
}

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

label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.input-row {
  height: 50px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.input-row span {
  width: 42px;
  text-align: center;
  color: var(--green);
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

input {
  height: 100%;
}

.auth-form button,
.search button {
  min-height: 50px;
}

.hint {
  min-height: 22px;
  color: var(--muted);
}

.legal-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -10px 0 26px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 0.86rem;
}

a {
  color: #bfe8ff;
  text-decoration: none;
  font-weight: 800;
}

a:hover {
  text-decoration: underline;
}

.messenger {
  height: min(820px, calc(100vh - 56px));
  min-height: 620px;
  display: grid;
  grid-template-columns: 330px 1fr;
  border-radius: 8px;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(9, 13, 19, 0.42);
}

.profile {
  gap: 13px;
}

.profile strong {
  display: block;
  margin-top: 3px;
}

.safety-card {
  margin-top: auto;
  border: 1px solid rgba(84, 227, 158, 0.22);
  border-radius: 8px;
  padding: 16px;
  background: rgba(84, 227, 158, 0.075);
  color: #cfe8df;
  line-height: 1.5;
}

.card-title {
  margin: 0 0 8px;
  font-weight: 900;
}

.safety-card p:last-child {
  margin: 0;
}

.safety-card a {
  display: inline-block;
  margin-top: 10px;
}

.chat {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-head {
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 23, 33, 0.58);
}

.head-actions {
  gap: 10px;
}

.status {
  white-space: nowrap;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid rgba(80, 184, 255, 0.26);
  color: #bfe8ff;
  background: rgba(80, 184, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
}

.ghost {
  min-height: 37px;
  padding: 0 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.messages {
  position: relative;
  overflow-y: auto;
  padding: 22px;
  scroll-behavior: smooth;
}

.empty {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}

.pulse {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(80, 184, 255, 0.24), rgba(84, 227, 158, 0.24));
  box-shadow: 0 0 0 0 rgba(80, 184, 255, 0.34);
  animation: pulse 1.9s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 22px rgba(80, 184, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(80, 184, 255, 0); }
}

.message {
  width: fit-content;
  max-width: min(560px, 84%);
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
  animation: rise 220ms ease both;
  overflow-wrap: anywhere;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.out {
  margin-left: auto;
  background: linear-gradient(135deg, rgba(80, 184, 255, 0.92), rgba(84, 227, 158, 0.86));
  color: #041015;
}

.message.in {
  background: rgba(255, 255, 255, 0.08);
  color: #eaf2ff;
  border: 1px solid var(--line);
}

.composer-wrap {
  padding: 16px 22px 20px;
  border-top: 1px solid var(--line);
  background: rgba(10, 14, 20, 0.62);
}

.ai-note {
  min-height: 24px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.ai-note.bad {
  color: var(--red);
}

.ai-note.good {
  color: var(--green);
}

.composer {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
}

textarea {
  min-height: 48px;
  max-height: 130px;
  resize: none;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  line-height: 1.35;
}

@media (max-width: 780px) {
  .shell {
    width: 100%;
    min-height: 100vh;
    padding: 0;
  }

  .auth-panel,
  .messenger {
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .messenger {
    height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

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

  .safety-card {
    display: none;
  }

  .chat-head {
    padding: 14px 16px;
  }

  .messages {
    padding: 16px;
  }

  .composer-wrap {
    padding: 12px 16px 16px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer button {
    min-height: 46px;
  }

  .legal-strip {
    align-items: flex-start;
    flex-direction: column;
  }
}

.legal-page {
  width: min(920px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.legal-hero,
.legal-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 23, 33, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.legal-hero {
  padding: clamp(24px, 5vw, 44px);
  margin-bottom: 12px;
}

.legal-hero h1 {
  margin: 8px 0 16px;
  font-size: clamp(2.1rem, 6vw, 4rem);
}

.legal-hero p,
.legal-section p,
.legal-section li {
  color: #c9d7e7;
  line-height: 1.65;
}

.legal-section {
  padding: 24px;
  margin-bottom: 12px;
}

.legal-section h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
}

.legal-section p:last-child,
.legal-section ul:last-child {
  margin-bottom: 0;
}

.hint {
  color: var(--muted);
  font-weight: 600;
}

.login-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  color: #041018;
  font-size: 1.02rem;
  text-align: center;
  box-shadow: 0 16px 36px rgba(80, 184, 255, 0.18);
}

.login-button::after {
  content: "->";
  margin-left: 10px;
}

.microcopy {
  margin: -2px 0 0;
  color: #aebfd2;
  font-size: 0.86rem;
  line-height: 1.45;
}


.inbox-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
}

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

.notify-toggle {
  min-height: 34px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

.inbox-total {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 800;
}

.inbox-total.has-unread {
  color: #061016;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.inbox-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.inbox-item {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
}

.inbox-item:hover {
  transform: none;
}

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

.inbox-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.inbox-item b {
  min-width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #061016;
  background: var(--green);
  font-size: 0.82rem;
}

.inbox-item.unread {
  border-color: rgba(84, 227, 158, 0.62);
  background: rgba(84, 227, 158, 0.12);
}

.inbox-empty {
  color: var(--muted);
  font-size: 0.88rem;
}
