.sidebar-bottom {
  padding: 12px 12px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  margin-top: auto;
}

.sidebar-bottom .nav-link {
  height: 45px;
  padding: 0 16px;
  width: 100%;
}

.sidebar-bottom .material-symbols-rounded {
  font-size: 24px;
}

.sidebar-auth-slot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  min-height: 56px;
  position: relative;
}

.sidebar-login-box {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #fefefe;
  padding: 14px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-login-copy {
  color: var(--text-low);
  font-size: 0.84rem;
  line-height: 1.35;
  margin-top: -2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: text;
}

.sidebar-login-copy .line {
  display: block;
}

.sidebar-login-copy .emphasis {
  font-size: 1rem;
  font-weight: 650;
  color: #1f1f1f;
}

.sidebar-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 42px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--brand-primary);
  color: var(--text-on-brand);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-login-btn:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-elevated);
}

.sidebar-bottom-profile {
  margin-top: auto;
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  padding-top: 10px;
  min-height: 48px;
  position: relative;
}

.sidebar-user-menu-wrap {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  z-index: 1300;
}

.sidebar-profile-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #000;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  padding: 0;
  cursor: pointer;
}

.sidebar-profile-btn .profile-avatar {
  width: 34px;
  height: 34px;
  background: transparent;
  font-size: 0.9rem;
  padding-top: 2px;
  padding-left: 1px;
}

.sidebar-user-menu-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 4px;
  z-index: 1400;
}

.sidebar-user-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1f1f1f;
  text-decoration: none;
}

.sidebar-user-menu-item:hover {
  background: var(--brand-primary-soft);
}

.sidebar-user-menu-item.danger {
  color: #000;
}

.search-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  z-index: 20000;
}

.search-modal-overlay.show {
  display: flex;
}

.search-modal {
  width: min(92vw, 680px);
  max-height: min(84vh, 760px);
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-modal-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-high);
}

.search-modal-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-med);
}

.search-modal-close:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.search-modal-body {
  padding: 14px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.search-modal-input-wrap {
  position: relative;
}

.search-modal-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-low);
  pointer-events: none;
}

.search-modal-input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0 12px 0 40px;
  font-size: 0.92rem;
  color: var(--text-high);
  background: #fff;
  outline: none;
}

.search-modal-input:focus {
  border-color: #c7c7c7;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

#chatSearchModalResults {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#chatSearchModalResults .history-chat-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100%;
  height: 44px;
  padding: 0 12px !important;
  border: none !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
}

#chatSearchModalResults .history-chat-btn .nav-text {
  margin-left: 0 !important;
  font-size: 0.9rem;
}

#chatSearchModalResults .history-chat-btn:hover {
  background: var(--brand-primary-soft) !important;
}

#chatSearchModalResults .history-chat-btn.active {
  background: var(--brand-primary-soft) !important;
  font-weight: 500;
}

.search-empty {
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text-low);
}

.search-empty.error {
  color: #b00020;
}

body.search-modal-open {
  overflow: hidden;
}

body.search-modal-open > *:not(#chatSearchModalOverlay) {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

body.search-modal-open #chatSearchModalOverlay {
  filter: none;
  pointer-events: auto;
}

.viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

.header-bar {
  height: var(--header-h);
  padding: 0 20px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border-bottom: none;
  z-index: 50;
}

.logo-text {
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--brand-primary), #3a3a3a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn {
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-high);
}

.btn-outline:hover {
  background: var(--brand-primary-soft);
  border-color: var(--brand-primary);
}

.btn-primary {
  background: var(--brand-primary);
  color: var(--text-on-brand);
}

.btn-primary:hover {
  box-shadow: var(--shadow-elevated);
  filter: brightness(1.1);
}

#chat-scroller {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0 140px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

#chat-container {
  width: 100%;
  max-width: var(--input-max-w);
  padding: 0 24px;
}

.message {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s var(--ease);
}

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

.user-message {
  align-items: flex-end;
}
