* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #090b10;
  color: #f5f7fb;
  font-family: Inter, Arial, sans-serif;
}

body {
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  max-width: 900px;
  margin: auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top, #172138 0%, #090b10 38%);
}

.topbar {
  min-height: 62px;
  padding:
    max(10px, env(safe-area-inset-top))
    16px
    8px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  border-bottom: 1px solid rgba(255,255,255,.07);
  backdrop-filter: blur(18px);
}

.icon-btn {
  border: 0;
  background: transparent;
  color: white;
  font-size: 25px;
}

.assistant-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.assistant-title strong {
  font-size: 16px;
}

.assistant-title span {
  color: #44db8b;
  font-size: 11px;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px 150px;
}

.welcome {
  min-height: 68vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.logo-orb {
  width: 72px;
  height: 72px;
  border-radius: 25px;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 800;
  background: linear-gradient(135deg,#29c7ff,#5754ff,#b044ff);
  box-shadow: 0 16px 50px rgba(93,78,255,.35);
}

.welcome h1 {
  margin: 22px 0 8px;
  font-size: 29px;
}

.welcome p {
  max-width: 420px;
  margin: 0;
  color: #9ba2b0;
  line-height: 1.6;
}

.message-row {
  width: 100%;
  display: flex;
  margin: 11px 0;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message {
  max-width: 86%;
  padding: 13px 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-row.user .message {
  background: #262a34;
  border-radius: 20px 20px 5px 20px;
}

.message-row.assistant .message {
  padding-left: 2px;
  background: transparent;
}

.stream-status {
  min-height: 20px;
  padding: 0 18px;
  font-size: 12px;
  color: #9197a5;
}

.composer-wrap {
  position: absolute;
  bottom: 0;
  width: 100%;
  max-width: 900px;

  padding:
    8px 12px
    max(10px, env(safe-area-inset-bottom));

  background:
    linear-gradient(
      transparent,
      rgba(9,11,16,.93) 25%,
      #090b10 70%
    );
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;

  padding: 8px;

  background: #181b22;
  border: 1px solid #2b303a;
  border-radius: 26px;

  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}

.composer textarea {
  flex: 1;
  max-height: 140px;
  min-height: 38px;

  resize: none;
  border: 0;
  outline: 0;

  background: transparent;
  color: white;

  padding: 9px 5px;

  font-size: 16px;
}

.composer textarea::placeholder {
  color: #808692;
}

.attach-btn,
.mic-btn,
.send-btn {
  width: 40px;
  height: 40px;

  border-radius: 50%;
  border: 0;

  display: grid;
  place-items: center;

  cursor: pointer;
}

.attach-btn,
.mic-btn {
  background: transparent;
  color: white;
  font-size: 23px;
}

.send-btn {
  background: white;
  color: #090b10;

  font-size: 26px;
  font-weight: bold;
}

.send-btn:disabled {
  opacity: .35;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;

  width: 300px;
  max-width: 84vw;

  background: #111319;

  z-index: 100;

  transform: translateX(-105%);
  transition: transform .22s ease;

  display: flex;
  flex-direction: column;

  border-right:
    1px solid rgba(255,255,255,.07);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-backdrop {
  display: none;

  position: fixed;
  inset: 0;

  background:
    rgba(0,0,0,.55);

  z-index: 90;
}

.sidebar-backdrop.open {
  display: block;
}

.sidebar-top {
  padding:
    max(18px,env(safe-area-inset-top))
    14px
    10px;
}

.new-chat {
  width: 100%;

  padding: 13px 15px;

  background: #1d2028;
  color: white;

  border:
    1px solid #30343e;

  border-radius: 14px;

  text-align: left;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;

  padding: 6px 10px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 8px;

  margin: 3px 0;

  border-radius: 11px;
}

.conversation-open {
  flex: 1;

  border: 0;
  background: transparent;
  color: #dbdee6;

  padding: 11px;

  text-align: left;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-delete {
  width: 35px;
  height: 35px;

  border: 0;
  background: transparent;
  color: #777e8b;
}

.conversation-item.active {
  background: #232630;
}

.sidebar-footer {
  padding:
    12px
    14px
    max(16px,env(safe-area-inset-bottom));

  border-top:
    1px solid rgba(255,255,255,.07);
}

.sidebar-footer a,
.sidebar-footer button {
  display: block;

  width: 100%;

  padding: 11px 5px;

  border: 0;

  background: transparent;
  color: #d7dae2;

  text-decoration: none;

  text-align: left;
}

.profile-mini img {
  width: 34px;
  height: 34px;

  border-radius: 50%;
}

.profile-mini {
  text-decoration: none;
}

.server-selector {
  margin: 12px 0;
  padding: 13px;
  border-radius: 17px;
  background: #151820;
  border: 1px solid #2c313b;
}

.server-selector-title {
  margin-bottom: 10px;
  font-weight: 700;
}

.server-option {
  width: 100%;
  margin: 5px 0;
  padding: 12px;

  border-radius: 12px;
  border: 1px solid #323743;

  background: #1c2029;
  color: white;

  text-align: left;
}

.server-option small {
  display: block;
  color: #9199a8;
  margin-top: 4px;
}

.pending-attachment {
  max-width: 900px;
  width: 100%;

  margin: 0 auto;

  padding: 8px 14px;
}

.pending-image-card {
  width: 92px;
  height: 92px;

  position: relative;

  border-radius: 15px;

  overflow: hidden;

  background: #161a20;

  border:
    1px solid #303641;
}

.pending-image-card img {
  width: 100%;
  height: 100%;

  object-fit: cover;
}

.pending-image-remove {
  position: absolute;

  top: 5px;
  right: 5px;

  width: 26px;
  height: 26px;

  border: 0;
  border-radius: 50%;

  background:
    rgba(0,0,0,.75);

  color: white;
}

.agent-progress {
  margin: 10px 0;
  padding: 13px 15px;

  border:
    1px solid #292f3a;

  background:
    #12151b;

  border-radius: 16px;

  font-size: 13px;

  color: #a9b0bd;
}

.agent-progress-line {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 5px 0;
}

.agent-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: #56dc8b;
}

.generated-image {
  width: min(100%,420px);

  margin-top: 10px;

  border-radius: 18px;

  display: block;

  border:
    1px solid #292f39;
}

.voice-screen {
  display: none;

  position: fixed;
  inset: 0;

  z-index: 500;

  background:
    radial-gradient(
      circle at 50% 45%,
      #15204a,
      #090b10 55%
    );

  color: white;
}

.voice-screen.open {
  display: flex;
  flex-direction: column;
}

.voice-header {
  height: 70px;

  padding: 10px 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-header button {
  width: 42px;
  height: 42px;

  border-radius: 50%;
  border: 0;

  background:
    rgba(255,255,255,.08);

  color: white;

  font-size: 25px;
}

.voice-center {
  flex: 1;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;
}

.voice-orb {
  width: 190px;
  height: 190px;

  border-radius: 50%;

  display: grid;
  place-items: center;

  background:
    radial-gradient(
      circle,
      #3178ff,
      #7048ef 45%,
      #161c3c 70%
    );

  box-shadow:
    0 0 80px rgba(72,103,255,.45);
}

.voice-wave {
  font-size: 65px;

  animation:
    voicePulse 1.4s infinite;
}

@keyframes voicePulse {
  0%,100%{
    transform:scale(.75);
    opacity:.5
  }

  50%{
    transform:scale(1.15);
    opacity:1
  }
}

.voice-center h2 {
  margin:
    34px 0 8px;
}

.voice-center p {
  color:#929aaa;
}

.voice-controls {
  display:flex;

  justify-content:center;

  gap:28px;

  padding:
    30px
    20px
    max(35px,env(safe-area-inset-bottom));
}

.voice-controls button {
  width:65px;
  height:65px;

  border-radius:50%;

  border:
    1px solid #343b4a;

  background:#171b25;
  color:white;

  font-size:23px;
}

.message pre {
  overflow-x: auto;

  padding: 14px;

  background: #11141a;

  border:
    1px solid #292f39;

  border-radius: 13px;
}

.message code {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
}

.message p {
  margin:
    0 0 10px;
}

.message p:last-child {
  margin-bottom: 0;
}

.message ul,
.message ol {
  padding-left: 23px;
}

.message a {
  color: #78a9ff;
}

.attach-sheet {
  display:none;
  position:fixed;
  inset:0;
  z-index:450;
  background:rgba(0,0,0,.6);
  align-items:flex-end;
}

.attach-sheet.open {
  display:flex;
}

.attach-sheet-box {
  width:100%;
  max-width:900px;
  margin:0 auto;
  padding:14px 14px max(20px,env(safe-area-inset-bottom));
  background:#171a21;
  border-radius:22px 22px 0 0;
}

.attach-sheet-box button {
  width:100%;
  min-height:54px;
  margin:4px 0;
  padding:0 16px;
  border:0;
  border-radius:14px;
  background:#222631;
  color:white;
  font-size:16px;
  text-align:left;
}

.pending-attachment:empty {
  display:none;
}

.ai-selector {
  margin: 8px 0 14px;

  padding: 13px;

  background: #151922;

  border:
    1px solid #2b313d;

  border-radius: 18px;
}

.ai-selector-title {
  margin-bottom: 9px;

  font-size: 14px;
  font-weight: 700;
}

.ai-selector-option {
  width: 100%;

  padding: 12px 13px;

  margin: 5px 0;

  background: #202530;

  color: #fff;

  border:
    1px solid #343b49;

  border-radius: 13px;

  text-align: left;
}

.ai-selector-option strong {
  display: block;
}

.ai-selector-option small {
  display: block;

  margin-top: 4px;

  color: #949cab;
}

.ai-selector-empty {
  color: #9ca3b1;

  font-size: 14px;
}

.agent-status {
  margin-top: 10px;

  padding: 11px 13px;

  background: #12161d;

  border:
    1px solid #272d37;

  border-radius: 14px;

  font-size: 13px;

  color: #a8afbb;
}

.agent-status-line {
  display: flex;

  align-items: center;

  gap: 8px;

  padding: 4px 0;
}

.agent-status-dot {
  width: 7px;
  height: 7px;

  flex: 0 0 auto;

  border-radius: 50%;

  background: #38d982;
}

.agent-status-line.done {
  opacity: .72;
}

.voice-message-tag {
  display: inline-flex;

  align-items: center;

  gap: 4px;

  margin-bottom: 5px;

  font-size: 11px;

  color: #8d96a7;
}

.message-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 6px;

  margin-top: 8px;
}

.message-action-btn {
  min-height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 5px;

  padding: 5px 9px;

  border: 0;
  border-radius: 9px;

  background: transparent;
  color: #8f97a7;

  font-size: 12px;

  cursor: pointer;
}

.message-action-btn:active {
  background: rgba(255,255,255,.08);
}

.message-action-btn.active {
  color: #ffffff;
}

.message-row.user .message-actions {
  justify-content: flex-end;
}

.voice-message-tag {
  display: flex;
  align-items: center;
  gap: 4px;

  margin-bottom: 5px;

  color: #929aaa;
  font-size: 11px;
}
