.response-shell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  position: relative;
  padding-top: 2px;
}

.response-live-content[hidden] {
  display: none !important;
}

.response-live-content {
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.12s ease;
  width: 100%;
  min-height: 34px;
  will-change: opacity;
}

.response-shell.stream-visible .response-live-content {
  opacity: 1;
}

.thinking-shell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border: 3px solid #8a6b3f;
  border-radius: 7px;
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(138, 107, 63, 0.08),
    0 8px 18px rgba(138, 107, 63, 0.12);
  padding: 0;
  margin-top: 0;
  opacity: 1;
  transform-origin: center;
  animation: thinkingSquareBreathe 1.45s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  transition: none;
  will-change: transform, opacity;
}

.thinking-shell > * {
  display: none !important;
}

.response-shell.stream-visible .thinking-shell {
  opacity: 1;
  pointer-events: none;
}

@keyframes thinkingSquareBreathe {
  0% {
    opacity: 0.62;
    transform: rotate(0deg) scale(0.9) translateZ(0);
  }

  45% {
    opacity: 1;
    transform: rotate(180deg) scale(1.08) translateZ(0);
  }

  100% {
    opacity: 0.62;
    transform: rotate(360deg) scale(0.9) translateZ(0);
  }
}

.stream-status {
  font-size: 0.86rem;
  color: var(--text-low);
  margin: 2px 0 8px 0;
}

.stream-status.searching-status {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-height: 30px;
  padding: 0 12px 0 10px;
  color: #6f542f;
  background:
    linear-gradient(135deg, rgba(255, 251, 244, 0.98), rgba(255, 255, 255, 0.94)),
    radial-gradient(circle at 18% 50%, rgba(138, 107, 63, 0.12), transparent 38%);
  border: 1px solid rgba(138, 107, 63, 0.18);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(138, 107, 63, 0.08);
  font-weight: 700;
  isolation: isolate;
}

.stream-status.searching-status::before {
  content: "";
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(138, 107, 63, 0.28);
  border-top-color: #8a6b3f;
  border-radius: 50%;
  flex: 0 0 auto;
  animation: yiaiSearchSpin 0.72s linear infinite;
}

.stream-status.searching-status::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  transform: translateX(-115%);
  background: linear-gradient(
    105deg,
    transparent,
    rgba(255, 255, 255, 0.78),
    rgba(138, 107, 63, 0.1),
    transparent
  );
  animation: yiaiSearchSheen 1.25s ease-in-out infinite;
}

@keyframes yiaiSearchSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes yiaiSearchSheen {
  0%,
  18% {
    transform: translateX(-115%);
  }

  to {
    transform: translateX(115%);
  }
}

.stream-plain {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-family: "Google Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  color: var(--text-high);
}

.stream-plain.typing::after {
  content: "|";
  margin-left: 1px;
  animation: streamCursorBlink 1s steps(1) infinite;
}

@keyframes streamCursorBlink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

.stream-final {
  line-height: 1.7;
}

.response-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  width: fit-content;
}

.response-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #5f6368;
}

.response-action-btn .material-symbols-rounded {
  font-size: 18px;
  line-height: 1;
  font-variation-settings:
    "FILL" 0,
    "wght" 500,
    "GRAD" 0,
    "opsz" 24;
}

.response-action-btn:hover .material-symbols-rounded {
  color: #202124;
}

.response-action-btn.selected .material-symbols-rounded {
  color: #000000;
  font-variation-settings:
    "FILL" 1,
    "wght" 500,
    "GRAD" 0,
    "opsz" 24;
}

.response-action-btn.locked {
  cursor: default;
}

#auth-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-sidebar-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #1f1f1f;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-sidebar-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.profile-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  padding-top: 3px;
  padding-left: 1px;
}

.tools-wrap {
  position: relative;
}

.tools-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: none;
  z-index: 1200;
}

.tools-menu.show {
  display: block;
}

.tools-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-high);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

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

.chat-context-menu {
  position: fixed;
  z-index: 9999;
  min-width: 76px;
  width: max-content;
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
  opacity: 0;
  transform: translate(-50%, -6px) scale(0.98);
  transform-origin: top center;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s ease;
}

.chat-context-menu.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.chat-context-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-high);
  font-size: 0.88rem;
}

.chat-context-item:hover {
  background: var(--brand-primary-soft);
}

.chat-context-item.danger {
  color: #d93025;
}

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

.modal-card {
  width: min(92vw, 420px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  padding: 20px;
}

.modal-title {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  color: #1f1f1f;
}

.modal-body-text {
  margin: 0 0 16px 0;
  color: #444746;
  font-size: 0.95rem;
}

.modal-input {
  width: 100%;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn-secondary {
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #1f1f1f;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}

.modal-btn-primary {
  border: none;
  background: #000000;
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}

.admin-panel-btn {
  gap: 6px;
}

.admin-panel-btn .material-symbols-rounded {
  font-size: 19px;
}

.admin-modal-card {
  width: min(94vw, 560px);
  padding: 18px;
}

.admin-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-gate-grid,
.admin-panel-view,
.admin-panel-grant {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-panel-row {
  display: flex;
  gap: 8px;
}

.admin-panel-row .modal-input,
.admin-panel-grant .modal-input,
.admin-gate-grid .modal-input {
  margin-bottom: 0;
}

.admin-wide-btn {
  width: 100%;
  justify-content: center;
}

.admin-panel-message,
.admin-empty {
  color: #5f6368;
  font-size: 0.88rem;
  min-height: 18px;
}

.admin-user-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
}

.admin-user-row {
  width: 100%;
  border: 1px solid #ececec;
  background: #f8f8f8;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.admin-user-row:hover {
  background: #f1f1f1;
}

.admin-user-row span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-user-row strong,
.admin-user-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row small {
  color: #6b6b6b;
}

.admin-user-row em {
  color: #1f1f1f;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

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

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

#sidebar-top-nav {
  padding-top: 6px;
}

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

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

#sidebar-history {
  padding: 0 12px 12px 16px !important;
}

#sidebar.collapsed .history-label {
  display: none !important;
}

#sidebar.collapsed #historyToggleBtn,
#sidebar.collapsed #sidebar-history {
  display: none !important;
}

#sidebar.collapsed #sidebar-history {
  display: none;
}

#sidebar.collapsed .sidebar-login-box {
  display: none !important;
}

#sidebar.collapsed .sidebar-bottom {
  padding: 12px 12px 10px;
}

#sidebar.collapsed .sidebar-auth-slot {
  width: 100%;
  min-height: 56px;
}

#sidebar.collapsed .sidebar-bottom-profile {
  width: 100%;
}

#sidebar.collapsed .sidebar-user-menu-wrap {
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
}

#sidebar.collapsed .sidebar-user-menu-panel {
  left: calc(100% + 12px);
  top: -6px;
  bottom: auto;
}
