:root {
  --void: #0b0d10;
  --night: #14171c;
  --panel: #1c2026;
  --lift: #262b33;
  --line: rgba(214, 220, 228, 0.16);
  --moon: #e7ebf0;
  --silver: #c5ccd4;
  --steel: #8b939d;
  --shine: linear-gradient(
    135deg,
    #f6f8fa 0%,
    #c8d0d8 38%,
    #9aa4ae 62%,
    #dfe4ea 100%
  );
  --glass: linear-gradient(
    180deg,
    rgba(232, 236, 241, 0.08),
    rgba(140, 148, 158, 0.04)
  );
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(210, 216, 224, 0.08), transparent 50%),
    radial-gradient(900px 500px at 0% 100%, rgba(168, 176, 186, 0.06), transparent 46%),
    var(--void);
  color: var(--moon);
  font-family: "Segoe UI", "Helvetica Neue", Tahoma, Arial, sans-serif;
}

body {
  min-height: 100dvh;
}

.hidden {
  display: none !important;
}

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login {
  width: min(100%, 320px);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass), var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login input,
.composer textarea,
.ghost,
.send,
.mic,
.quiet,
.icon {
  font: inherit;
  color: var(--moon);
}

.login input,
.composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(10, 12, 15, 0.55);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.login input:focus,
.composer textarea:focus {
  border-color: rgba(214, 220, 228, 0.42);
  box-shadow: 0 0 0 3px rgba(197, 204, 212, 0.12);
}

.login button,
.send,
.ghost {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
}

.login button,
.send {
  background: var(--shine);
  color: #1a1d22;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(0, 0, 0, 0.25);
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #181c22, #12151a);
  border-left: 1px solid var(--line);
}

.side-top,
.side-foot,
.topbar,
.composer {
  padding: 14px;
}

.threads {
  flex: 1;
  overflow: auto;
  padding: 0 10px 10px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.thread-group {
  margin: 14px 6px 2px;
  color: var(--steel);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.thread {
  width: 100%;
  text-align: right;
  border: 1px solid transparent;
  background: transparent;
  color: var(--silver);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.thread.active,
.thread:hover {
  background: var(--lift);
  border-color: var(--line);
  color: var(--moon);
}

.quiet,
.icon {
  background: transparent;
  border: 0;
  color: var(--steel);
  cursor: pointer;
}

.ghost {
  width: 100%;
  background: var(--lift);
  border: 1px solid var(--line);
  color: var(--moon);
}

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 23, 28, 0.86);
  backdrop-filter: blur(16px);
}

.title {
  flex: 1;
  margin: 0;
  color: var(--silver);
  font-size: 15px;
}

.dock {
  padding: 10px 16px 18px;
}

.hint {
  min-height: 18px;
  margin: 0 8px 8px;
  color: var(--steel);
  font-size: 13px;
}

.log {
  overflow: auto;
  padding: 22px 16px 40px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.bubble {
  max-width: min(720px, 92%);
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.user {
  justify-self: start;
  background: var(--shine);
  color: #16191e;
}

.bubble.assistant {
  justify-self: end;
  background: var(--glass), var(--panel);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.bubble.report {
  justify-self: end;
  background: #22272e;
  border: 1px dashed rgba(214, 220, 228, 0.28);
  color: var(--silver);
  font-size: 14px;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--glass), var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.composer textarea {
  resize: none;
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  border: 0;
  background: transparent;
  padding: 10px 8px;
  box-shadow: none;
}

.composer textarea:focus {
  border: 0;
  box-shadow: none;
}

.mic,
.send {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mic {
  background: var(--lift);
  color: var(--moon);
}

.mic svg {
  width: 22px;
  height: 22px;
}

.mic.live {
  background: var(--shine);
  color: #171a1f;
}

.mic.busy {
  opacity: 0.6;
}

.send {
  background: var(--shine);
  color: #1a1d22;
  font-size: 16px;
}

.icon {
  display: none;
  font-size: 22px;
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(86vw, 300px);
    transform: translateX(110%);
    transition: transform 0.2s ease;
    z-index: 8;
  }
  .sidebar.open {
    transform: none;
  }
  .icon {
    display: inline-flex;
  }
}
