/* Chat app: scrollable thread list, studio drawer hooks, upgrade toast */

.thread-list-scroll {
  flex: 1;
  min-height: 0;
  max-height: min(42vh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--chat-border);
  background: rgba(15, 15, 15, 0.65);
  -webkit-overflow-scrolling: touch;
}

.thread-list-scroll::-webkit-scrollbar {
  width: 5px;
}

.thread-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

.sidebar-thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thread-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.thread-list-item:last-child {
  margin-bottom: 0;
}

.thread-list-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.thread-list-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--chat-border);
}

.thread-list-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.88);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 6px;
}

.thread-list-item__main:hover {
  color: #ffffff;
}

.thread-list-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-list-item__input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--chat-border-focus);
  background: #0f0f0f;
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
}

.thread-list-item__input:focus {
  outline: none;
  border-color: #ffffff;
}

.thread-list-item__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.thread-list-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.thread-list-icon-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.thread-list-icon-btn:focus-visible {
  outline: 2px solid var(--chat-border-focus);
  outline-offset: 1px;
}

.thread-list-icon-btn--danger:hover {
  color: #ffb4b4;
}

.nav-item--btn {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: none;
  margin-bottom: 4px;
}

.sidebar-footer-stack {
  margin-top: auto;
  padding-top: 12px;
}

.sidebar-bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar--compact .sidebar-thread-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.sidebar-bottom-actions .nav-item--btn {
  margin-bottom: 0;
}

/* App drawers (chat) — layer above support drawer */
.vortex-app-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  z-index: 16000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.vortex-app-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.vortex-app-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100%;
  background: #000000;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  z-index: 16001;
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
}

.vortex-app-drawer.open {
  transform: translateX(0);
}

.vortex-app-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.vortex-app-drawer__head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  line-height: 1.35;
}

.vortex-app-drawer__sub {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.45;
}

.vortex-app-drawer__close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #ffffff;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vortex-app-drawer__close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.vortex-app-drawer__body {
  padding: 20px 22px 28px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.vortex-app-field {
  margin-bottom: 18px;
}

.vortex-app-field label {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
}

.vortex-app-field input[type="text"],
.vortex-app-field textarea,
.vortex-app-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0d0d0d;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
}

.vortex-app-field textarea {
  min-height: 120px;
  resize: vertical;
}

.vortex-app-field input:focus,
.vortex-app-field textarea:focus,
.vortex-app-field select:focus {
  outline: none;
  border-color: #ffffff;
}

.vortex-app-field--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 400px) {
  .vortex-app-field--split {
    grid-template-columns: 1fr;
  }
}

.vortex-app-hint {
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
  margin: -6px 0 16px;
}

.vortex-app-submit {
  width: 100%;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid #ffffff;
  background: #ffffff;
  color: #000000;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.vortex-app-submit:hover:not(:disabled) {
  opacity: 0.9;
}

.vortex-app-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vortex-app-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 22px 0;
}

.vortex-app-settings-block h3 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.vortex-app-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vortex-app-toggle-row:last-of-type {
  border-bottom: none;
}

.vortex-app-toggle-row__text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 4px;
}

.vortex-app-toggle-row__text span {
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.52);
}

.vortex-app-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #161616;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.vortex-app-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.vortex-app-switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

.vortex-app-switch[aria-checked="true"] {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.45);
}

.vortex-app-link-out {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.vortex-app-link-out:hover {
  opacity: 0.88;
}

.pg-chat-toast--lux {
  min-width: min(340px, calc(100vw - 32px));
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  line-height: 1.5;
  font-size: 13px;
  font-weight: 500;
  z-index: 17050;
  pointer-events: auto;
}

.pg-chat-toast--lux a {
  color: #ffffff;
  font-weight: 700;
}
