@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  /* Default theme: Bright Teal */
  --bg-color: #fefefe;
  --text-color: #1a1a1a;
  --accent-color: #00b3a6;
  --card-bg: #ffffff;
  --muted: #f3f4f6;
  --shadow: 0 6px 24px rgba(0,0,0,0.08);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background-color: #E7F0FA;
  color: #202123;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
               "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.bubble {
  white-space: pre-wrap;
}

.header,
.card,
button,
input,
textarea {
  border-radius: 12px;
}

.header {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background-color: #ffffff;
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Session indicator in header */
.session-indicator {
  margin-left: 0.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* If header uses flex, keep left side tidy */
.top-bar .top-left {
  display: flex;
  flex-direction: column;
}

/* On mobile, keep it from wrapping weirdly */
@media (max-width: 640px) {
  .session-indicator {
    font-size: 0.75rem;
  }
}

.update-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  background: #111827;
  color: #f9fafb;
  font-size: 13px;
}

.update-banner.show {
  display: flex;
}

.update-banner button {
  border: none;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
}

button {
  background: #e5e7eb; /* neutral */
  color: #111827;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: #dbe0e6;
  border-color: #dbe0e6;
}

/* Only “primary” actions use accent; theme button stays neutral per your request */
button.primary {
  background: var(--accent-color);
  color: #fff;
  border: none;
}

.card {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 12px;
}

/* Theme variants (applied via JS by changing CSS variables) */

/* Modern Account Modal Styles - Gradient Theme */
@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.account-card-modern {
  animation: slideInFromLeft 0.6s ease-out;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 0;
  width: min(500px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.account-header-modern {
  position: relative;
  padding: 32px 24px 20px 24px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.account-header-modern h2 {
  font-size: 32px;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.account-header-modern p {
  font-size: 14px;
  color: #d1d5db;
  margin: 0;
}

.close-btn-modern {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.close-btn-modern:hover {
  opacity: 0.8;
}

.auth-tabs-modern {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0;
}

.auth-tab-modern {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 12px 16px 12px 0;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.auth-tab-modern.active {
  color: #ffffff;
  border-bottom-color: #7e22ce;
}

.auth-tab-modern:hover {
  color: #ffffff;
}

.account-form-modern {
  padding: 24px;
}

.form-group-modern {
  position: relative;
  margin-bottom: 18px;
}

.input-modern {
  width: 100%;
  height: 40px;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #ffffff;
  font-size: 14px;
  padding: 8px 0;
  outline: none;
  transition: border-color 0.3s;
}

.input-modern::placeholder {
  color: transparent;
}

.input-modern:focus {
  border-bottom-color: #9d4edd;
}

.input-modern:focus + .label-modern,
.input-modern:not(:placeholder-shown) + .label-modern {
  top: -24px;
  font-size: 12px;
  color: #9d4edd;
}

.label-modern {
  position: absolute;
  left: 0;
  top: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  transition: all 0.3s ease;
  pointer-events: none;
}

.form-options-modern {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  font-size: 13px;
}

.checkbox-modern {
  display: flex;
  align-items: center;
  color: #d1d5db;
  cursor: pointer;
}

.checkbox-modern input {
  margin-right: 6px;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.forgot-link-modern {
  color: #c084fc;
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-link-modern:hover {
  text-decoration: underline;
}

.button-modern {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #7e22ce 0%, #a855f7 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.3);
}

.button-modern:hover {
  background: linear-gradient(135deg, #9d4edd 0%, #c084fc 100%);
  box-shadow: 0 6px 16px rgba(126, 34, 206, 0.4);
}

.button-modern:active {
  transform: translateY(1px);
}

.button-modern.secondary {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  margin-top: 8px;
}

.button-modern.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.toggle-auth-modern {
  padding: 16px 24px;
  text-align: center;
  color: #d1d5db;
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.link-modern {
  color: #c084fc;
  text-decoration: none;
  font-weight: 600;
}

.link-modern:hover {
  text-decoration: underline;
}

.signed-in-modern {
  padding: 24px;
}

.badge-modern {
  display: inline-block;
  background: linear-gradient(135deg, #9d4edd 0%, #c084fc 100%);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.profile-section-modern {
  margin-bottom: 16px;
}

.actions-modern {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 600px) {
  .account-card-modern {
    width: 95vw;
  }
  
  .account-header-modern {
    padding: 24px 16px 16px 16px;
  }
  
  .account-header-modern h2 {
    font-size: 24px;
  }
  
  .account-form-modern {
    padding: 16px;
  }
}
[data-theme="calm-sky"] {
  --bg-color: #f0f7ff;
  --text-color: #111827;
  --accent-color: #3b82f6;
  --card-bg: #ffffff;
}

[data-theme="warm-amber"] {
  --bg-color: #fffaf0;
  --text-color: #3a2e1f;
  --accent-color: #f59e0b;
  --card-bg: #fff8e1;
}

body[data-theme="light"] {
  background-color: #ffffff;
  color: #111827;
}

body[data-theme="dark"] {
  background-color: #0f172a;
  color: #e5e7eb;
}

.page {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.hidden {
  display: none !important;
}

.content-columns {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 0 16px;
}

.content-columns .chat {
  flex: 1;
  margin: 0;
  min-width: 0;
}

.account-panel {
  flex: 0 0 360px;
  max-width: 420px;
}

.account-panel .account-card-modern {
  width: 100%;
  max-height: none;
  position: static;
}

#accountBackdrop {
  display: none !important;
}

.side-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
  z-index: 40;
}

.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  width: 80%;
  max-width: 340px;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  transform: translateX(-100%);
  transition: transform 200ms ease-out;
  z-index: 41;
}

.side-menu-inner {
  width: 100%;
  height: 100%;
  background: #f9fafb;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.side-menu-title {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
}

.side-menu-close {
  border: none;
  background: #e5e7eb;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  color: #374151;
}

.side-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.side-menu-item {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.side-menu-item:active {
  background: #e5e7eb;
}

.side-menu-item-danger {
  color: #b91c1c;
}

.side-menu-footer {
  margin-top: auto;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 15px;
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.menu-item:active {
  background: #e5e7eb;
}

.menu-item-danger {
  color: #b91c1c;
}

/* Open state */
.side-menu-open .side-menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.side-menu-open .side-menu {
  transform: translateX(0);
}

/* Keep menu button styling light */
.menu-button {
  border-radius: 999px;
  border: none;
  padding: 8px 10px;
  background: #f4f4f5;
  font-size: 16px;
  cursor: pointer;
}

.menu-button:hover {
  background: #e5e5ea;
}

.empty-state {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.empty-state-card {
  max-width: 520px;
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  padding: 24px 20px 20px;
  backdrop-filter: blur(18px);
}

@media (prefers-color-scheme: dark) {
  .empty-state-card {
    background: rgba(15, 23, 42, 0.9);
  }
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state-subtitle {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-bottom: 16px;
}

.empty-state-hints p {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.empty-state-hints ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.empty-state-hints li {
  padding: 4px 0;
  opacity: 0.85;
}

.empty-state-hidden {
  display: none !important;
}

.home-dashboard {
  display: none;
  flex-direction: column;
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 6px 90px;
}

.home-dashboard-visible {
  display: flex;
}

.home-dashboard-hidden {
  display: none !important;
}

.home-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 18px 18px 20px;
  background: radial-gradient(circle at 20% 20%, #fdf7f2 0%, #edf4ff 45%, #dbeafe 100%);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% 10%, rgba(99, 102, 241, 0.25), transparent 45%);
  pointer-events: none;
}

.home-hero-kicker {
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: #4338ca;
  margin: 0;
}

.home-greeting-title {
  position: relative;
  z-index: 1;
  margin: 6px 0 2px;
  font-size: 1.65rem;
  font-weight: 800;
  color: #0b1220;
}

.home-greeting-sub {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #111827;
  opacity: 0.8;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.home-card {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
}

.home-card:hover {
  border-color: rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}

.home-continue-card {
  cursor: pointer;
  background: linear-gradient(135deg, #4338ca, #4f46e5, #1d4ed8);
  color: #f8fafc;
  box-shadow: 0 16px 38px rgba(67, 56, 202, 0.3);
}

.home-continue-card .home-card-subtitle {
  color: #e0e7ff;
}

.home-empty-card {
  background: #f8fafc;
}

.home-card-label {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.home-card-subtitle {
  margin: 0;
  color: #4b5563;
}

.home-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.home-recent-block {
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.home-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.home-recent-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.home-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-recent-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.1s ease, background 0.12s ease;
}

.home-recent-item:hover {
  border-color: rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
  background: #ffffff;
}

.home-recent-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.home-recent-subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.vibe-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: #eef2ff;
  color: #312e81;
  white-space: nowrap;
}

.badge-science { background: #e0f2fe; color: #0b5394; border-color: #bae6fd; }
.badge-productivity { background: #ecfdf3; color: #166534; border-color: #bbf7d0; }
.badge-reflection { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.badge-creative { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge-career { background: #fef9c3; color: #854d0e; border-color: #fef08a; }
.badge-relationships { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.badge-history { background: #e5e7eb; color: #374151; border-color: #d1d5db; }
.badge-puzzles { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.badge-neutral { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }

@media (max-width: 640px) {
  .home-hero {
    padding: 16px;
  }
  .home-greeting-title {
    font-size: 1.4rem;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
}

.chat {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

main.chat,
#chat {
  flex: 1 1 auto;
  overflow-y: auto;
}

#input-footer {
  width: 100%;
  flex-shrink: 0;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.chat-input-shell {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-icon-btn {
  flex: 0 0 auto;
  height: 40px;
  width: 40px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: #f4f4f5;
  color: #111827;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat-icon-btn.active {
  background: #111827;
  color: #f9fafb;
}

.chat-icon-btn.listening {
  background: #111827;
  color: #f9fafb;
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.15);
}

.chat-icon-btn.danger {
  color: #b91c1c;
}

.chat-icon-btn.disabled,
.chat-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.chat-input-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.25rem 0.35rem 0.25rem 0.9rem;
  border: 1px solid #e5e7eb;
}

.input-bar {
  background: #f5f5f5;
  border: 1px solid #ddd;
}

body.voice-mode-active .voice-btn {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
  background: #111827;
  color: #ffffff;
}

body.voice-mode-active .input-bar {
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.23);
}

.chat-textarea {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 16px;
  line-height: 1.4;
  max-height: 5.5rem;
  min-height: 34px;
  color: #222;
  font-weight: 500;
}

.chat-textarea::placeholder {
  color: #888;
  font-weight: 400;
}

.chat-send-btn {
  flex: 0 0 auto;
  border-radius: 999px;
  border: none;
  height: 32px;
  width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #f9fafb;
  font-size: 0.85rem;
  cursor: pointer;
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 640px) {
  #input-footer {
    padding-inline: 0.75rem;
  }

  .chat-input-shell {
    gap: 0.4rem;
  }

  .chat-icon-btn {
    height: 36px;
    width: 36px;
    font-size: 0.8rem;
  }

  .chat-input-main {
    padding-inline: 0.75rem 0.3rem;
  }

  .chat-textarea {
    font-size: 16px;
  }
}

@media (max-width: 900px) {
  .content-columns {
    flex-direction: column;
  }

  .account-panel {
    width: 100%;
    max-width: none;
  }
}

/* Settings modal */
.settings-sheet {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.35);
  backdrop-filter: blur(12px);
  z-index: 1000;
}

.settings-sheet.is-hidden {
  display: none;
}

.settings-sheet-inner {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg, #ffffff);
  border-radius: 16px;
  box-shadow: 0 25px 80px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--border, #e5e7eb);
  overflow: hidden;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  background: var(--muted, #f3f4f6);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.settings-tab {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
  color: #111827;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.settings-tab.is-active {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.settings-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.settings-panel {
  display: none;
}

.settings-panel.is-active {
  display: block;
}

.settings-card {
  background: var(--panel, #f8fafc);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.settings-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-label {
  font-weight: 600;
  color: #0f172a;
}

.settings-helper {
  color: #6b7280;
  font-size: 13px;
}

.settings-value {
  font-weight: 600;
  color: #111827;
}

.settings-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
}

.badge-muted {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-success {
  background: #ecfdf3;
  color: #065f46;
}

.settings-action-btn {
  width: 100%;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--border, #e5e7eb);
  background: #ffffff;
  padding: 12px 14px;
  font-weight: 600;
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
  margin-top: 10px;
}

.settings-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.settings-action-btn.settings-danger {
  color: #b91c1c;
  border-color: #fecdd3;
  background: #fff1f2;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 10px 0;
}

.settings-toggle input {
  display: none;
}

.settings-toggle-ui {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e5e7eb;
  position: relative;
  transition: background 0.2s ease;
}

.settings-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.settings-toggle input:checked + .settings-toggle-ui {
  background: #111827;
}

.settings-toggle input:checked + .settings-toggle-ui::after {
  transform: translateX(20px);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  background: #f3f4f6;
  padding: 6px;
  border-radius: 12px;
}

.segmented-item {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  padding: 10px 12px;
  font-weight: 600;
  color: #111827;
  box-shadow: none;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.segmented-item.is-active {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.pill-button {
  border-radius: 999px;
  padding: 8px 14px;
  border: 1px solid var(--border, #e5e7eb);
  background: #f8fafc;
  font-weight: 600;
  color: #0f172a;
}

.pill-button-secondary {
  background: #ffffff;
}

@media (max-width: 520px) {
  .settings-sheet-inner {
    max-height: 90vh;
    overflow: auto;
  }

  .settings-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.voice-mode-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.voice-mode-overlay.hidden {
  display: none;
}

.voice-mode-inner {
  background: #f9fafb;
  border-radius: 28px;
  padding: 24px 20px 32px;
  width: min(480px, 90vw);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.voice-mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 500;
}

.voice-mode-title {
  color: #111827;
}

.voice-mode-close {
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  background: #e5e7eb;
  color: #111827;
  cursor: pointer;
}

.voice-mode-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  padding-top: 8px;
  padding-bottom: 8px;
}

.voice-mode-prompt {
  font-size: 18px;
  line-height: 1.4;
  color: #111827;
  margin: 0;
}

.voice-mode-transcript {
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

.voice-mode-mic {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  border: none;
  background: radial-gradient(circle at 30% 30%, #4f46e5, #111827);
  color: #ffffff;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.voice-mode-mic::after {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  opacity: 0;
  pointer-events: none;
}

/* When voice mode is open, dim the chat input row */
body.voice-mode-open .chat-input-shell,
body.voice-mode-open .chat-input-main {
  opacity: 0.15;
  pointer-events: none;
}

@keyframes voiceMicPulse {
  0% { transform: scale(1); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45); }
  50% { transform: scale(1.05); box-shadow: 0 24px 46px rgba(79, 70, 229, 0.55); }
  100% { transform: scale(1); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.45); }
}

.voice-mode-overlay[data-state="listening"] .voice-mode-mic {
  animation: voiceMicPulse 1.4s ease-in-out infinite;
}

.voice-mode-overlay[data-state="listening"] .voice-mode-mic::after {
  opacity: 0.15;
}

.voice-mode-overlay[data-state="thinking"] .voice-mode-mic {
  opacity: 0.7;
  animation: none;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.voice-mode-overlay[data-state="thinking"] .voice-mode-mic::after {
  opacity: 1;
  border: 2px solid rgba(255,255,255,0.55);
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* === AUTH MODAL BASE === */

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 25, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

/* Glassy card */
.auth-modal-card {
  position: relative;
  pointer-events: auto;
  width: 100%;
  max-width: 420px;
  margin: 0 16px;
  border-radius: 28px;
  padding: 20px 20px 24px;
  background: radial-gradient(circle at top left, #ffffff 0, #f5f7ff 40%, #e7f0fa 100%);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.25),
    0 0 0 1px rgba(148, 163, 184, 0.25);
}

/* 3D gradient header band */
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.auth-modal-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, #4f46e5, #2563eb);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.6);
}

.auth-logo-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.35);
}

.auth-logo-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e5e7ff;
}

.auth-close-btn {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

/* Hero text */
.auth-modal-hero h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 4px 0;
  color: #020617;
}

.auth-modal-hero p {
  font-size: 0.9rem;
  color: #64748b;
}

/* Tabs */
.auth-tabs {
  display: inline-flex;
  margin-top: 16px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
}

.auth-tab {
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  cursor: pointer;
}

.auth-tab.active {
  background: #0f172a;
  color: #f9fafb;
}

/* Form */
.auth-form {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #475569;
}

.auth-field input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 10px 14px;
  font-size: 0.9rem;
  outline: none;
  background: rgba(255, 255, 255, 0.9);
}

.auth-field input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.45);
}

/* Extra rows */
.auth-extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-top: 4px;
}

.auth-extra-row.hidden {
  display: none;
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.auth-checkbox input {
  accent-color: #4f46e5;
}

.auth-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.78rem;
  color: #4f46e5;
  cursor: pointer;
}

/* Hint + error */
.auth-hint {
  font-size: 0.78rem;
  color: #64748b;
}

.auth-error {
  margin-top: 6px;
  font-size: 0.8rem;
  color: #dc2626;
}

.auth-error.hidden {
  display: none;
}

/* Submit button */
.auth-submit-btn {
  margin-top: 12px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.93rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #6366f1, #0ea5e9);
  box-shadow:
    0 10px 30px rgba(79, 70, 229, 0.6),
    0 0 0 1px rgba(191, 219, 254, 0.6);
}

/* === DARK THEME OVERRIDES === */

body[data-theme="dark"] .auth-modal-backdrop,
.theme-dark .auth-modal-backdrop {
  background: rgba(15, 23, 42, 0.75);
}

body[data-theme="dark"] .auth-modal-card,
.theme-dark .auth-modal-card {
  background: radial-gradient(circle at top left, #0b1120 0, #020617 50%, #020617 100%);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(30, 64, 175, 0.7);
}

body[data-theme="dark"] .auth-modal-hero h2,
.theme-dark .auth-modal-hero h2 {
  color: #e5e7eb;
}

body[data-theme="dark"] .auth-modal-hero p,
body[data-theme="dark"] .auth-label,
body[data-theme="dark"] .auth-hint,
.theme-dark .auth-modal-hero p,
.theme-dark .auth-label,
.theme-dark .auth-hint {
  color: #9ca3af;
}

body[data-theme="dark"] .auth-tabs,
.theme-dark .auth-tabs {
  background: rgba(15, 23, 42, 0.7);
}

body[data-theme="dark"] .auth-tab,
.theme-dark .auth-tab {
  color: #9ca3af;
}

body[data-theme="dark"] .auth-tab.active,
.theme-dark .auth-tab.active {
  background: #f9fafb;
  color: #020617;
}

body[data-theme="dark"] .auth-field input,
.theme-dark .auth-field input {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-color: rgba(55, 65, 81, 0.9);
}

body[data-theme="dark"] .auth-submit-btn,
.theme-dark .auth-submit-btn {
  box-shadow:
    0 16px 40px rgba(59, 130, 246, 0.85),
    0 0 0 1px rgba(129, 140, 248, 0.9);
}

/* === PROFILE MODAL === */

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.profile-modal.hidden {
  display: none;
}

.profile-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 32, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  pointer-events: auto;
}

.profile-modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 18px;
  border-radius: 28px;
  padding: 22px 22px 26px;
  background: radial-gradient(circle at top left, #ffffff 0, #f5f7ff 40%, #e7f0fa 100%);
  box-shadow:
    0 28px 68px rgba(15, 23, 42, 0.3),
    0 0 0 1px rgba(148, 163, 184, 0.25);
  pointer-events: auto;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-id-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: #f8fafc;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.35);
}

.profile-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
}

.profile-subtitle {
  margin: 2px 0 0;
  color: #475569;
  font-size: 0.92rem;
}

.profile-close-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
  font-weight: 600;
  cursor: pointer;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-section {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.profile-section-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: #0f172a;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.profile-field:last-child {
  margin-bottom: 0;
}

.profile-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.profile-field input,
.profile-field select,
.profile-value {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 10px 12px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
}

.profile-field select {
  cursor: pointer;
}

.profile-field.read-only .profile-value {
  background: rgba(248, 250, 252, 0.8);
  color: #475569;
}

.profile-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.profile-primary-btn,
.profile-secondary-btn,
.profile-danger-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

.profile-primary-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1, #0ea5e9);
  color: #fff;
  box-shadow: 0 12px 32px rgba(79, 70, 229, 0.45);
}

.profile-secondary-btn {
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.profile-danger {
  margin-top: 6px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(254, 242, 242, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-danger-title {
  font-weight: 700;
  color: #991b1b;
}

.profile-danger-text {
  margin: 4px 0 0;
  color: #b91c1c;
  font-size: 0.92rem;
}

.profile-danger-btn {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.35);
}

.profile-status {
  min-height: 18px;
  font-size: 0.9rem;
  color: #0f172a;
}

.profile-status.error {
  color: #dc2626;
}

.profile-status.success {
  color: #16a34a;
}

/* Profile summary (settings) */
.profile-card-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-summary {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-weight: 700;
  color: #0f172a;
}

.profile-email,
.profile-join {
  color: #475569;
  font-size: 0.95rem;
}

.profile-actions-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-actions-inline .settings-action-btn {
  margin-left: auto;
}

/* Dark theme */
body[data-theme="dark"] .profile-modal-card,
.theme-dark .profile-modal-card {
  background: radial-gradient(circle at top left, #0b1120 0, #020617 50%, #020617 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(30, 64, 175, 0.6);
}

body[data-theme="dark"] .profile-section,
.theme-dark .profile-section {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(59, 73, 102, 0.7);
}

body[data-theme="dark"] .profile-label,
body[data-theme="dark"] .profile-subtitle,
body[data-theme="dark"] .profile-email,
body[data-theme="dark"] .profile-join,
.theme-dark .profile-label,
.theme-dark .profile-subtitle,
.theme-dark .profile-email,
.theme-dark .profile-join {
  color: #cbd5e1;
}

body[data-theme="dark"] .profile-title,
body[data-theme="dark"] .profile-name,
.theme-dark .profile-title,
.theme-dark .profile-name {
  color: #e5e7eb;
}

body[data-theme="dark"] .profile-field input,
body[data-theme="dark"] .profile-field select,
body[data-theme="dark"] .profile-value,
.theme-dark .profile-field input,
.theme-dark .profile-field select,
.theme-dark .profile-value {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.6);
}

body[data-theme="dark"] .profile-danger,
.theme-dark .profile-danger {
  background: rgba(127, 29, 29, 0.2);
  border-color: rgba(248, 113, 113, 0.35);
}
