.app-shell {
  min-height: 100svh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;

  height: 68px;

  display: flex;
  align-items: center;

  background: var(--bg-header);

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  border-bottom:
    1px solid var(--border-color);
}

.topbar-inner {
  width: min(100%, 960px);
  margin-inline: auto;

  padding-inline: 14px;

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

  gap: 10px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.icon-btn {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  border-radius: 14px;

  color: var(--text-secondary);
  background: var(--bg-input-wrapper);

  box-shadow: var(--shadow-sm);

  transition:
    color .2s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.icon-btn:hover {
  color: var(--accent-primary);
}

.icon-btn:active {
  transform: translateY(1px);
  box-shadow: var(--inset-sm);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 9px;

  min-width: 0;
}

.brand-avatar,
.avatar {
  object-fit: cover;

  border-radius: 50%;

  background: var(--bg-sidebar);

  border: 2px solid var(--accent-primary);

  box-shadow:
    var(--shadow-sm),
    0 0 0 3px rgba(255, 0, 127, 0.08);
}

.brand-avatar {
  width: 39px;
  height: 39px;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  display: block;

  font-family: var(--font-display);
  font-size: .96rem;
  font-weight: 700;

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

.brand-status {
  display: flex;
  align-items: center;
  gap: 6px;

  color: var(--text-secondary);
  font-size: .68rem;
}

.online-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;

  border-radius: 50%;

  background: var(--online-dot);

  box-shadow:
    0 0 7px var(--accent-primary);

  animation:
    onlinePulse 1.2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%,
  100% {
    opacity: .45;
    transform: scale(.85);
  }

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

.chat-main {
  width: min(100%, 860px);
  min-height: calc(100svh - 68px);

  margin-inline: auto;

  display: flex;
  flex-direction: column;
}

.chat-scroll {
  flex: 1;

  width: 100%;

  padding:
    18px
    14px
    130px;
}

.welcome-screen {
  min-height: 58svh;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;

  padding:
    30px
    8px;
}

.welcome-avatar {
  width: 88px;
  height: 88px;

  margin-bottom: 18px;

  border-width: 3px;

  box-shadow:
    var(--shadow-lg),
    0 0 28px var(--accent-glow);
}

.welcome-screen h1 {
  max-width: 520px;

  font-family: var(--font-display);
  font-size: clamp(1.42rem, 5vw, 2.1rem);
  line-height: 1.25;

  margin-bottom: 10px;
}

.welcome-screen p {
  max-width: 500px;

  color: var(--text-secondary);

  font-size: .9rem;
  line-height: 1.65;
}

.helper-prompts {
  width: 100%;
  max-width: 580px;

  margin-top: 22px;

  display: grid;
  grid-template-columns: 1fr;

  gap: 10px;
}

.helper-chip {
  padding: 12px 14px;

  text-align: left;

  border-radius: 14px;

  color: var(--text-primary);
  background: var(--bg-input-wrapper);

  box-shadow: var(--shadow-sm);

  transition:
    color .2s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.helper-chip:hover {
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.helper-chip:active {
  transform: translateY(1px);
  box-shadow: var(--inset-sm);
}

.helper-chip i {
  width: 22px;
  color: var(--accent-primary);
}

.composer-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  z-index: 70;

  padding:
    10px
    max(
      10px,
      env(safe-area-inset-right)
    )
    calc(
      10px +
      env(safe-area-inset-bottom)
    )
    max(
      10px,
      env(safe-area-inset-left)
    );

  background:
    linear-gradient(
      to top,
      var(--bg-app) 70%,
      transparent
    );
}

.composer {
  width: min(100%, 820px);
  margin-inline: auto;

  padding: 8px;

  border-radius: 20px;

  background: var(--bg-input-wrapper);

  box-shadow:
    var(--shadow-lg);
}

.attach-preview {
  display: flex;
  align-items: center;
  gap: 9px;

  padding:
    7px
    9px;

  margin-bottom: 7px;

  border-radius: 12px;

  background: var(--bg-ai-bubble);

  box-shadow: var(--inset-sm);
}

.attach-preview img {
  width: 38px;
  height: 38px;

  border-radius: 9px;

  object-fit: cover;
}

.attach-info {
  flex: 1;
  min-width: 0;
}

.attach-name {
  display: block;

  font-size: .75rem;
  font-weight: 600;

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

.attach-status {
  color: var(--text-secondary);
  font-size: .67rem;
}

.remove-attachment {
  width: 32px;
  height: 32px;

  display: grid;
  place-items: center;

  border-radius: 10px;

  color: var(--text-secondary);
  background: transparent;
}

.remove-attachment:hover {
  color: var(--accent-primary);
}

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

.composer-actions-left {
  display: flex;
  gap: 6px;
}

.composer-input {
  flex: 1;
  min-width: 0;

  min-height: 44px;
  max-height: 170px;

  padding:
    11px
    12px;

  border: 0;
  outline: 0;

  border-radius: 14px;

  color: var(--text-primary);
  background: transparent;

  box-shadow: var(--inset-sm);

  line-height: 1.5;
}

.composer-input::placeholder {
  color: var(--text-secondary);
}

.composer-icon-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;

  display: grid;
  place-items: center;

  border-radius: 13px;

  color: var(--text-secondary);
  background: var(--bg-input-wrapper);

  box-shadow: var(--shadow-sm);

  transition:
    color .2s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.composer-icon-btn:hover {
  color: var(--accent-primary);
}

.composer-icon-btn:active {
  transform: translateY(1px);
  box-shadow: var(--inset-sm);
}

.voice-btn.listening {
  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--accent-primary),
      var(--accent-secondary)
    );

  box-shadow:
    var(--shadow-sm),
    0 0 15px var(--accent-glow);
}

.send-btn {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;

  display: grid;
  place-items: center;

  border-radius: 14px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--accent-primary),
      var(--accent-secondary)
    );

  box-shadow:
    var(--shadow-md),
    0 0 18px rgba(255, 0, 127, .16);

  transition:
    transform .15s ease,
    box-shadow .15s ease,
    opacity .2s ease;
}

.send-btn:hover {
  transform: translateY(-1px);
}

.send-btn:active {
  transform: translateY(1px);

  box-shadow:
    var(--inset-sm),
    0 0 10px var(--accent-glow);
}

.send-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.composer-note {
  padding: 6px 5px 1px;

  text-align: center;

  color: var(--text-secondary);

  font-size: .61rem;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;

  z-index: 100;

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

  opacity: 0;
  pointer-events: none;

  transition: opacity .25s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

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

  z-index: 110;

  width: min(88vw, 340px);

  padding:
    16px;

  overflow-y: auto;

  background: var(--bg-sidebar);

  box-shadow:
    16px 0 35px rgba(0, 0, 0, .48),
    4px 4px 20px rgba(0, 0, 0, .25);

  transform: translateX(-105%);

  transition:
    transform .28s cubic-bezier(.65, 0, .35, 1);
}

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

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 16px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 13px;

  margin-bottom: 18px;

  border-radius: 17px;

  background: var(--bg-input-wrapper);

  box-shadow: var(--shadow-md);
}

.profile-avatar {
  width: 50px;
  height: 50px;
}

.profile-info {
  min-width: 0;
}

.profile-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .92rem;
}

.profile-sub {
  margin-top: 2px;

  color: var(--text-secondary);

  font-size: .67rem;
}

.sidebar-nav {
  display: grid;
  gap: 7px;
}

.sidebar-item {
  width: 100%;

  min-height: 46px;

  display: flex;
  align-items: center;
  gap: 11px;

  padding:
    9px
    11px;

  border-radius: 13px;

  text-align: left;

  color: var(--text-secondary);
  background: var(--bg-sidebar);

  transition:
    color .2s ease,
    transform .15s ease,
    box-shadow .15s ease;
}

.sidebar-item:hover {
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.sidebar-item:active {
  transform: translateY(1px);
  box-shadow: var(--inset-sm);
}

.sidebar-item i {
  width: 21px;

  text-align: center;

  color: var(--accent-primary);
}

.sidebar-section-title {
  margin:
    21px
    4px
    8px;

  color: var(--text-secondary);

  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.recent-list {
  display: grid;
  gap: 6px;
}

.recent-item {
  width: 100%;

  padding:
    10px
    11px;

  text-align: left;

  border-radius: 12px;

  color: var(--text-secondary);
  background: transparent;

  transition:
    color .2s ease,
    background .2s ease;
}

.recent-item:hover,
.recent-item.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.recent-title {
  display: block;

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

  font-size: .77rem;
}

.recent-time {
  display: block;

  margin-top: 3px;

  color: var(--text-secondary);

  font-size: .61rem;
}

.empty-recent {
  padding: 14px 4px;

  color: var(--text-secondary);

  font-size: .72rem;
}

.dialog-overlay {
  position: fixed;
  inset: 0;

  z-index: 200;

  display: grid;
  place-items: center;

  padding: 20px;

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

  backdrop-filter: blur(5px);
}

.dialog {
  width: min(100%, 480px);

  padding: 20px;

  border-radius: 21px;

  background: var(--bg-sidebar);

  box-shadow: var(--shadow-lg);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 10px;

  margin-bottom: 14px;
}

.dialog-head h2 {
  font-family: var(--font-display);
  font-size: 1.08rem;
}

.dialog-body {
  color: var(--text-secondary);
  font-size: .82rem;
  line-height: 1.7;
}

.dialog-body strong {
  color: var(--accent-primary);
}

@media (min-width: 640px) {
  .helper-prompts {
    grid-template-columns:
      repeat(3, 1fr);
  }

  .chat-scroll {
    padding-inline: 22px;
  }

  .topbar-inner {
    padding-inline: 22px;
  }

  .composer-wrap {
    padding-inline: 18px;
  }
}

@media (min-width: 960px) {
  .chat-main {
    min-height: calc(100svh - 68px);
  }
}
