.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  background: var(--color-bg);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 10;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.app-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--color-bg-soft);
  color: var(--color-text);
}

.header-btn svg {
  width: 20px;
  height: 20px;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-5);
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
}

.chat-messages {
  max-width: var(--max-chat-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-date-divider {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  padding: var(--space-3) 0;
  position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: var(--color-border);
}

.chat-date-divider::before { left: 0; }
.chat-date-divider::after { right: 0; }

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-5) var(--space-8);
  gap: var(--space-4);
}

.chat-welcome-icon-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  object-fit: cover;
}

.chat-welcome-icon {
  width: 64px;
  height: 64px;
  background: var(--color-accent-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.chat-welcome h1 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.chat-welcome p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  max-width: 400px;
  line-height: var(--line-height-relaxed);
}

.chat-welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-2);
}

.suggestion-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.suggestion-btn:hover {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.welcome-actions {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}

.welcome-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-5) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 200px;
}

.welcome-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  transform: translateY(-2px);
}

.welcome-btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

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

.welcome-btn-icon {
  font-size: 28px;
}

.welcome-btn-label {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.welcome-btn-desc {
  font-size: var(--font-size-xs);
  opacity: 0.7;
}

.input-area {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-5) var(--space-4);
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.input-wrapper {
  max-width: var(--max-chat-width);
  margin: 0 auto;
  display: flex;
  gap: var(--space-2);
  align-items: flex-end;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.input-wrapper textarea {
  flex: 1;
  resize: none;
  padding: var(--space-2) 0;
  min-height: 24px;
  max-height: 120px;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  background: transparent;
  color: var(--color-text);
}

.input-wrapper textarea::placeholder {
  color: var(--color-text-tertiary);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

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

.send-btn svg {
  width: 18px;
  height: 18px;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-1) var(--space-4);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
  transition: color var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  color: var(--color-text-secondary);
}

.nav-item.active {
  color: var(--color-accent);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 0 0 2px 2px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item span {
  font-size: 10px;
  font-weight: var(--font-weight-medium);
}

@media (max-width: 768px) {
  .chat-welcome {
    padding: var(--space-8) var(--space-4) var(--space-6);
  }

  .chat-welcome-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }

.welcome-session-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  margin-top: calc(-1 * var(--space-3));
}

.chat-welcome h1 {
    font-size: var(--font-size-lg);
  }

  .input-area {
    padding: var(--space-2) var(--space-3) var(--space-3);
  }

  .input-wrapper {
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  }

  .send-btn {
    width: 36px;
    height: 36px;
  }
}
