:root {
  --bg-primary: #071626;
  --bg-secondary: #0C2435;
  --bg-surface: #131313;
  --bg-header: #2C2C2C;
  --bg-hover: #162f45;
  --text-primary: #F2F4F5;
  --text-secondary: #9DA7AD;
  --text-tertiary: #6b7780;
  --accent-kayos: #36E0D0;
  --accent-blue: #159FE5;
  --danger: #f28b82;
  --border-subtle: #1a3850;
  --border-focus: #36E0D0;
  --sidebar-width: 280px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --font-sans: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Roboto Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--border-subtle);
  z-index: 10;
  transition: margin-left 0.2s ease, width 0.2s ease;
  position: relative;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img { width: 28px; height: 28px; object-fit: contain; }

.app-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  perspective: 600px;
}

.logo-text-white { color: var(--text-primary); }

.logo-digit-four {
  color: var(--accent-kayos);
  display: inline-block;
  transform-style: preserve-3d;
  animation: spinY 3.5s linear infinite;
  margin: 0 1px;
  text-shadow: 0 0 12px rgba(54, 224, 208, 0.45);
}

@keyframes spinY {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

.btn-icon-subtle:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.model-pills-container {
  display: flex;
  background-color: var(--bg-primary);
  padding: 4px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
}

.pill-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.2s, color 0.2s;
}

.pill-tab.active {
  background-color: var(--accent-blue);
  color: #ffffff;
  font-weight: 600;
}

.pill-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background-color: rgba(54, 224, 208, 0.2);
  color: var(--accent-kayos);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.pill-tab.active .pill-badge {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.btn-new-chat {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 12px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background-color 0.2s, border-color 0.2s;
  width: 100%;
}

.btn-new-chat:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-blue);
}

.history-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: background-color 0.15s, color 0.15s;
}

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

.history-item.active {
  border-left: 3px solid var(--accent-blue);
}

/* SIDEBAR FOOTER PROFILE */
.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.user-profile-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.2s;
}

.user-profile-bar:hover {
  background-color: var(--bg-hover);
}

.user-avatar-mini {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0C2435 0%, #159FE5 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid var(--accent-cyan);
}

.user-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.user-tier {
  font-size: 0.7rem;
  color: var(--accent-kayos);
}

/* ACCOUNT MODAL POPUP */
.account-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 22, 38, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.account-modal {
  width: 380px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.7);
}

.account-modal-header {
  display: flex;
  justify-content: flex-end;
}

.account-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: var(--bg-primary);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.account-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0C2435 0%, #159FE5 100%);
  border: 2px solid var(--accent-kayos);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  position: relative;
}

.avatar-edit-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.account-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.account-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.account-plan-badge {
  display: inline-block;
  background-color: rgba(54, 224, 208, 0.15);
  color: var(--accent-kayos);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  width: fit-content;
  border: 1px solid rgba(54, 224, 208, 0.3);
}

.account-registration-entry {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background-color: var(--bg-primary);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.account-registration-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.account-registration-title {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.account-registration-description {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
}

.account-registration-providers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-registration-provider {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
}

.account-registration-provider:disabled {
  opacity: 0.72;
  cursor: default;
}

.account-provider-mark {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background-color: #ffffff;
  color: #202124;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.account-email-registration-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.account-email-registration-panel[hidden] {
  display: none;
}

.account-email-registration-label {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.account-email-registration-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
}

.account-email-registration-input:focus {
  border-color: var(--accent-kayos);
}

.account-email-registration-input::placeholder {
  color: var(--text-secondary);
}

.account-email-registration-continue {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
}

.account-email-registration-continue:disabled {
  opacity: 0.55;
  cursor: default;
}

.account-email-registration-help {
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.4;
}

.account-auth-intent-status {
  min-height: 18px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.4;
}

.account-registration-provider:not(:disabled) {
  cursor: pointer;
}

.account-registration-provider:not(:disabled):hover {
  background-color: var(--bg-hover);
}

.account-registration-provider:not(:disabled):focus-visible {
  outline: 2px solid var(--accent-kayos);
  outline-offset: 2px;
}

.account-registration-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.account-registration-divider > span:first-child,
.account-registration-divider > span:last-child {
  height: 1px;
  background-color: var(--border-subtle);
}

.account-actions-group {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.account-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.15s;
}

.account-action-item:last-child {
  border-bottom: none;
}

.account-action-item:hover {
  background-color: var(--bg-hover);
}

.account-alert-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-icon {
  width: 18px;
  height: 18px;
  background-color: var(--accent-kayos);
  color: #071626;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.alert-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-body {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.alert-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.btn-alert-dismiss {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 6px 10px;
  cursor: pointer;
}

.btn-alert-action {
  background-color: var(--accent-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

.chat-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
}

.header-right {
  display: flex;
  align-items: center;
  position: relative;
}

/* DROPDOWN MENU */
.menu-dropdown-wrapper {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 0;
  min-width: 230px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: none;
}

.dropdown-menu.show {
  display: flex;
  flex-direction: column;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s;
}

.dropdown-item:hover {
  background-color: var(--bg-hover);
}

.dropdown-item svg {
  color: var(--text-secondary);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger svg {
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 6px 0;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.welcome-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  gap: 32px;
}

.welcome-header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  background: linear-gradient(135deg, #159FE5 0%, #36E0D0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.welcome-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.prompt-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 140px;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
}

.prompt-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--accent-kayos);
  transform: translateY(-2px);
}

.prompt-card-text { font-size: 0.9rem; color: var(--text-primary); line-height: 1.4; }
.prompt-card-tag { font-size: 0.75rem; color: var(--accent-kayos); }

/* MESSAGE STRUCTURE */
.message-row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.message-row.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user .message-avatar {
  background-color: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.assistant .message-avatar {
  color: var(--accent-kayos);
}

.assistant .message-avatar.assistant-identity-mark {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 8px rgba(54, 224, 208, 0.34),
    0 0 16px rgba(54, 224, 208, 0.12);
}

.message-body {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 48px);
}

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

.message-bubble {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.6;
}

.user .message-bubble {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) 4px var(--radius-md) var(--radius-md);
}

.assistant .message-bubble {
  background-color: transparent;
  padding: 0;
}

.text-content {
  min-height: 24px;
}

.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-msg-action {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-msg-action:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.thinking-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.thinking-header {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.03);
}

.thinking-content {
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: none;
  white-space: pre-wrap;
  border-top: 1px solid var(--border-subtle);
}

.thinking-box.expanded .thinking-content { display: block; }


/* K4YOS PROCESSING SIGNAL -------------------------------------------------- */

.assistant-processing-state {
  min-height: 28px;
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text-tertiary);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.assistant-processing-label {
  opacity: 0.72;
}









.processing-active .k4yos-processing-dot {
  animation:
    k4yosProcessingPulse 1.05s
    cubic-bezier(0.4, 0, 0.2, 1)
    infinite;
}

.message-row.processing-active
.assistant-processing-state {
  opacity: 1;
}

@keyframes k4yosProcessingPulse {
  0%,
  100% {
    opacity: 0.2;
    transform:
      scale(0.66)
      translateZ(0);
  }

  42% {
    opacity: 1;
    transform:
      scale(1.28)
      translateY(-1px);
  }

  68% {
    opacity: 0.58;
    transform:
      scale(0.92)
      translateY(0);
  }
}


.code-block-wrapper {
  margin: 14px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #030a12;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #071626;
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.btn-copy-code {
  background: transparent;
  border: none;
  color: var(--accent-kayos);
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-copy-code:hover { filter: brightness(1.2); }

pre { padding: 14px; overflow-x: auto; margin: 0; }
code { font-family: var(--font-mono); font-size: 0.85rem; }

.input-dock {
  padding: 16px 24px 24px 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.input-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 12px rgba(54, 224, 208, 0.15);
}

.attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.attachment-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachment-remove { cursor: pointer; color: var(--text-tertiary); }
.attachment-remove:hover { color: var(--text-primary); }

textarea#promptInput {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  resize: none;
  max-height: 200px;
  min-height: 48px;
  line-height: 1.5;
}

.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.action-buttons-left, .action-buttons-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.model-selector-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.model-selector-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 7px 10px;
  min-height: 34px;
  max-width: 230px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.model-selector-button:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.model-selector-button:focus,
.model-selector-button[aria-expanded="true"] {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.model-selector-button:disabled {
  cursor: default;
  opacity: 0.6;
}

.model-selector-chevron {
  width: 7px;
  height: 7px;
  border-left: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-top: 4px;
}

.model-selector-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 1000;
  display: none;
  width: 260px;
  max-height: min(420px, calc(100vh - 150px));
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow:
    0 -14px 34px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(54, 224, 208, 0.08);
}

.model-selector-menu.show {
  display: block;
}

.model-selector-group + .model-selector-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.model-selector-group-label {
  padding: 6px 10px;
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.model-selector-option {
  display: flex;
  width: 100%;
  align-items: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.model-selector-option:hover,
.model-selector-option:focus {
  background: var(--bg-hover);
  color: var(--text-primary);
  outline: none;
}

.model-selector-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-send {
  background: var(--accent-kayos);
  color: #071626;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-weight: 700;
  transition: filter 0.2s, transform 0.1s;
}

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

/* K4YOS CANONICAL INFINITY THINKING INDICATOR */

.k4yos-infinity-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  user-select: none;
}

.k4yos-infinity-svg {
  width: 36px;
  height: 18px;
  overflow: visible;
}

.k4yos-infinity-track {
  fill: none;
  stroke: rgba(0, 255, 255, 0.15);
  stroke-width: 5;
  stroke-linejoin: round;
}

.k4yos-infinity-glow {
  fill: none;
  stroke: #00ffff;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 25 75;
  filter:
    drop-shadow(0 0 3px #00ffff)
    drop-shadow(0 0 6px rgba(0, 255, 255, 0.6));
  animation: k4yos-trace-infinity 1.5s linear infinite;
  will-change: stroke-dashoffset;
}

@keyframes k4yos-trace-infinity {
  from {
    stroke-dashoffset: 100;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.assistant-processing-label {
  animation: k4yos-processing-label-pulse 2s ease-in-out infinite;
  will-change: opacity;
}

@keyframes k4yos-processing-label-pulse {
  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .k4yos-infinity-glow,
  .assistant-processing-label {
    animation: none;
  }

  .k4yos-infinity-glow {
    stroke-dasharray: none;
  }

  .assistant-processing-label {
    opacity: 1;
  }
}


/* K4YOS SMART SCROLL FOLLOW */

.scroll-to-bottom-button {
  position: fixed;
  left: 50%;
  bottom: 116px;
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(54, 224, 208, 0.34);
  border-radius: 50%;
  background: rgba(11, 27, 39, 0.94);
  color: var(--text-primary);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.34),
    0 0 12px rgba(54, 224, 208, 0.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
  z-index: 90;
  cursor: pointer;
}

.scroll-to-bottom-button.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.scroll-to-bottom-button:hover {
  border-color: rgba(54, 224, 208, 0.68);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.38),
    0 0 16px rgba(54, 224, 208, 0.16);
}

.scroll-to-bottom-button:focus-visible {
  outline: 2px solid var(--accent-kayos);
  outline-offset: 2px;
}

.scroll-to-bottom-button svg {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-to-bottom-button {
    transition: none;
  }
}


/* K4YOS ANONYMOUS AUTH FLOW V1 */

.anonymous-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.anonymous-auth-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.anonymous-auth-button-primary {
  background: var(--accent-kayos);
  color: #071626;
  border-color: var(--accent-kayos);
}

.anonymous-auth-button:hover,
.anonymous-auth-button:focus-visible {
  border-color: var(--accent-kayos);
  outline: none;
}

.account-auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

.account-auth-mode-button {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.account-auth-mode-button.active {
  background: var(--accent-kayos);
  color: #071626;
}

.account-registration-providers[hidden] {
  display: none;
}

.account-modal {
  max-height: min(720px, calc(100vh - 48px));
  overflow-y: auto;
}

[data-account-authenticated-only="true"][hidden] {
  display: none !important;
}


/* K4YOS EMAIL VERIFICATION FLOW */
.account-email-verification-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.account-email-verification-panel[hidden] {
  display: none;
}

/* K4YOS authenticated state — Google direct transition */
.k4yos-authenticated-profile {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.k4yos-authenticated-profile[hidden] {
    display: none !important;
}

.k4yos-authenticated-profile__identity {
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(16, 18, 22, 0.92);
}

.k4yos-authenticated-profile__logout {
    padding: 0.55rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(16, 18, 22, 0.92);
    color: inherit;
    cursor: pointer;
}

/* K4YOS USER SPACE SIDEBAR MENU V2 */

.user-profile-bar {
  position: relative;
}

.user-profile-bar.k4yos-authenticated-profile {
  cursor: pointer;
}

.user-profile-bar.k4yos-authenticated-profile:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.28);
  outline-offset: 2px;
}

.user-profile-bar.k4yos-authenticated-profile[hidden] {
  display: none;
}

.k4yos-authenticated-profile__identity {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k4yos-user-space-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.k4yos-user-space-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 8px);
  z-index: 1300;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(28, 28, 30, 0.99);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.36);
}

.k4yos-user-space-menu[hidden] {
  display: none;
}

.k4yos-user-space-menu__item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.k4yos-user-space-menu__item:hover,
.k4yos-user-space-menu__item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.k4yos-user-space-menu__divider {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.10);
}

.k4yos-user-space-menu__item--danger {
  opacity: 0.9;
}


/* K4YOS GOOGLE PROFILE PICTURE DISPLAY HINT V1 */

.user-avatar-mini {
  overflow: hidden;
}

.k4yos-user-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

/* K4YOS_MICRO_UI_SCROLLBAR_001_R1_BEGIN */

/*
 * Barra deliberadamente mínima:
 * - 3px
 * - trilha invisível
 * - thumb quase invisível em repouso
 * - aparece somente quando a região recebe hover
 */

html,
body,
* {
    scrollbar-width: thin !important;
    scrollbar-color: transparent transparent !important;
}

html:hover,
body:hover,
*:hover {
    scrollbar-color: rgba(185, 195, 210, 0.38) transparent !important;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: 3px !important;
    height: 3px !important;
    background: transparent !important;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    min-height: 24px !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

html:hover::-webkit-scrollbar-thumb,
body:hover::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb {
    background: rgba(185, 195, 210, 0.34) !important;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background: rgba(210, 220, 230, 0.62) !important;
}

html::-webkit-scrollbar-button,
body::-webkit-scrollbar-button,
*::-webkit-scrollbar-button {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
    background: transparent !important;
}

/* K4YOS_MICRO_UI_SCROLLBAR_001_R1_END */

/* ================================================================ */
/* K4YOS CERTIFIED MOBILE RESPONSIVE LAYER — 5c416ae              */
/* ================================================================ */

@media (max-width: 932px) {
  :root {
    --sidebar-mobile-gap: 72px;
    --sidebar-mobile-width: min(72vw, 260px);
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    height: 100%;
    overflow: hidden;
  }

  body {
    position: relative;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-mobile-width);
    max-width: calc(100vw - var(--sidebar-mobile-gap));
    height: 100vh;
    height: 100dvh;
    margin-left: 0;
    padding: 14px 10px;
    transform: translateX(0);
    transition: transform 0.2s ease;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.45);
    z-index: 300;
  }

  .sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .main-content {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
  }

  .chat-header {
    flex: 0 0 52px;
    width: 100%;
    min-width: 0;
    padding: 0 12px;
  }

  .header-menu-btn {
    display: flex !important;
  }

  .dropdown-menu {
    max-width: calc(100vw - 24px);
  }

  .chat-container {
    max-width: none;
    min-height: 0;
    padding: 14px 12px 8px;
    gap: 14px;
  }

  .welcome-container {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    justify-content: flex-start;
    padding-top: clamp(72px, 18dvh, 148px);
    gap: 18px;
  }

  .welcome-header {
    width: 100%;
    text-align: center;
  }

  .welcome-header h1 {
    font-size: clamp(1.8rem, 8vw, 2.15rem);
    line-height: 1.1;
  }

  .welcome-header p {
    font-size: 1rem;
  }

  .cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .prompt-card {
    height: auto;
    min-height: 112px;
  }

  .message-row {
    gap: 10px;
  }

  .message-bubble,
  .text-content {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .input-dock {
    max-width: none;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .input-container {
    padding: 8px 10px;
    gap: 6px;
    border-radius: 14px;
  }

  textarea#promptInput {
    min-height: 40px;
    max-height: 128px;
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .account-modal-overlay {
    padding: 12px;
  }

  .account-modal {
    width: 100%;
    max-width: 380px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .account-user-card,
  .account-card-info {
    min-width: 0;
  }

  .account-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 932px) and (orientation: landscape) and (max-height: 500px) {
  .input-dock {
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom)) !important;
  }

  .chat-container {
    padding: 8px 12px !important;
    gap: 10px !important;
  }

  .welcome-container {
    gap: 12px !important;
  }

  .welcome-header h1 {
    font-size: 1.5rem !important;
  }

  .prompt-card {
    min-height: 64px !important;
  }

  /* Restringe a altura máxima do textarea para não consumir a tela inteira */
  .input-container textarea#promptInput {
    max-height: 80px !important;
  }
}
