/* ---- APP SHELL ---- */
.app-body {
  min-height: 100vh;
  background: var(--cream);
  display: flex;
  flex-direction: column;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 241, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(184, 169, 201, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
}

.app-nav-logo {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark-plum);
  text-decoration: none;
}

.app-nav-links {
  display: flex;
  gap: 0.5rem;
}

.app-nav-link {
  padding: 0.45rem 1.1rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.app-nav-link:hover {
  background: var(--whisper);
  color: var(--dark-plum);
}

.app-nav-link.active {
  background: var(--deep-lavender);
  color: white;
}

.app-main {
  flex: 1;
  padding: 2rem;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* ---- SHARED FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.6rem;
}

.form-optional {
  font-weight: 400;
  color: var(--text-light);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid rgba(184, 169, 201, 0.4);
  border-radius: 12px;
  background: white;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.92rem;
  line-height: 1.6;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--lavender);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.btn-primary {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  background: var(--deep-lavender);
  color: white;
  border: none;
  border-radius: 100px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--soft-plum);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: var(--lavender);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  background: transparent;
  color: var(--deep-lavender);
  border: 1.5px solid var(--lavender);
  border-radius: 100px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--whisper);
}

.hidden { display: none !important; }

/* ---- CHAT ---- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  max-width: 720px;
  margin: 0 auto;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(184, 169, 201, 0.2);
  flex-shrink: 0;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lavender), var(--blush));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.chat-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark-plum);
  line-height: 1.2;
}

.chat-subtitle {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-top: 0.1rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}

.msg-assistant { flex-direction: row; }
.msg-user { flex-direction: row-reverse; }

.msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lavender), var(--blush));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.msg-bubble {
  max-width: 80%;
  padding: 0.9rem 1.2rem;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  background: white;
  box-shadow: 0 1px 8px rgba(139, 123, 168, 0.08);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.msg-bubble p + p { margin-top: 0.6rem; }

.msg-bubble-user {
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  background: var(--deep-lavender);
  color: white;
  box-shadow: none;
}

/* Typing indicator */
.msg-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 1rem 1.2rem;
}

.msg-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lavender);
  display: inline-block;
  animation: bounce 1.2s infinite;
}

.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

.msg-error {
  color: #c0392b;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  background: #fdf0f0;
  border-radius: 8px;
  text-align: center;
}

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

.msg-enter { animation: fadeInUp 0.25s ease forwards; }

.chat-input-area {
  flex-shrink: 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(184, 169, 201, 0.2);
}

.chat-input-wrap {
  display: flex;
  gap: 0.8rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.9rem 1.2rem;
  border: 1.5px solid rgba(184, 169, 201, 0.4);
  border-radius: 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: white;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  overflow: hidden;
  max-height: 140px;
}

.chat-input:focus { border-color: var(--lavender); }
.chat-input::placeholder { color: var(--text-light); }

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--deep-lavender);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.chat-send-btn:hover { background: var(--soft-plum); transform: scale(1.05); }
.chat-send-btn:disabled { background: var(--lavender); cursor: not-allowed; transform: none; }

.chat-disclaimer {
  font-size: 0.72rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 0.6rem;
}

/* ---- VOICE UI ---- */

/* Mic button — sits in the input bar next to send */
.chat-mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  color: var(--deep-lavender);
  border: 1.5px solid rgba(184, 169, 201, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.chat-mic-btn:hover {
  background: var(--whisper);
  border-color: var(--lavender);
}

/* Pulsing mic when active (listening) */
.chat-mic-btn.mic-active {
  background: var(--deep-lavender);
  color: white;
  border-color: var(--deep-lavender);
  box-shadow: 0 0 0 0 rgba(139, 123, 168, 0.6);
  animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(139, 123, 168, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(139, 123, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 123, 168, 0); }
}

/* Voice visualizer — replaces text input during speech capture */
.voice-visualizer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1rem 0.5rem;
  animation: fadeInUp 0.2s ease forwards;
}

/* Audio waveform bars */
.voice-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
}

.voice-wave span {
  display: block;
  width: 5px;
  border-radius: 3px;
  background: var(--deep-lavender);
  animation: voice-bar 1.2s ease-in-out infinite;
}

.voice-wave span:nth-child(1) { height: 12px; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 24px; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 36px; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 24px; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 12px; animation-delay: 0.4s; }

@keyframes voice-bar {
  0%, 100% { transform: scaleY(0.5); opacity: 0.6; }
  50%       { transform: scaleY(1.4); opacity: 1; }
}

/* Live transcription text */
.voice-transcript {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  max-width: 400px;
  line-height: 1.5;
  min-height: 1.4em;
}

/* Stop recording button */
.voice-stop-btn {
  padding: 0.4rem 1.2rem;
  border-radius: 100px;
  border: 1.5px solid rgba(184, 169, 201, 0.5);
  background: white;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.voice-stop-btn:hover {
  border-color: var(--lavender);
  background: var(--whisper);
}

/* Voice mute toggle — top-right of chat header */
.voice-mute-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-size: 1.1rem;
  line-height: 1;
}

.voice-mute-btn:hover {
  background: var(--whisper);
}

/* ---- CHECK-IN ---- */
.checkin-container { max-width: 680px; margin: 0 auto; }

.checkin-header { margin-bottom: 2rem; }

.checkin-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.3rem;
}

.checkin-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

.checkin-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
  margin-bottom: 2rem;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.mood-btn {
  padding: 0.55rem 0.4rem;
  border: 1.5px solid rgba(184, 169, 201, 0.3);
  border-radius: 12px;
  background: var(--whisper);
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.mood-btn:hover { border-color: var(--lavender); background: white; }

.mood-btn.selected {
  border-color: var(--deep-lavender);
  background: var(--whisper);
  color: var(--deep-lavender);
  font-weight: 600;
}

.intensity-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--light-lilac), var(--deep-lavender));
  outline: none;
  margin: 0.5rem 0;
}

.intensity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--deep-lavender);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(139, 123, 168, 0.3);
}

.intensity-display {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--deep-lavender);
  margin-left: 0.3rem;
}

.intensity-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-light);
}

/* Reflection card */
.reflection-card {
  background: linear-gradient(145deg, var(--whisper), white);
  border: 1px solid rgba(184, 169, 201, 0.3);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.reflection-avatar {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

.reflection-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 0.8rem;
}

.reflection-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.8;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.reflection-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Recent check-ins */
.recent-checkins { margin-top: 1.5rem; }

.recent-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.recent-list { display: flex; flex-direction: column; gap: 0.6rem; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  background: white;
  border-radius: 14px;
  border: 1px solid rgba(184, 169, 201, 0.15);
}

.recent-mood-emoji { font-size: 1.4rem; flex-shrink: 0; }

.recent-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.recent-mood-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark-plum);
}

.recent-intensity, .recent-trigger {
  font-size: 0.76rem;
  color: var(--text-light);
}

.recent-time {
  font-size: 0.72rem;
  color: var(--text-light);
  flex-shrink: 0;
}

.recent-empty { font-size: 0.88rem; color: var(--text-light); font-style: italic; }

/* ---- GROUNDING ---- */
.grounding-container { max-width: 680px; margin: 0 auto; }

.grounding-header { margin-bottom: 2rem; }

.grounding-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.3rem;
}

.grounding-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

.tool-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tool-tab {
  padding: 0.55rem 1.2rem;
  border-radius: 100px;
  border: 1.5px solid rgba(184, 169, 201, 0.35);
  background: white;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.tool-tab:hover { border-color: var(--lavender); }

.tool-tab.active {
  background: var(--deep-lavender);
  color: white;
  border-color: var(--deep-lavender);
}

.tool-panel { display: none; }
.tool-panel.active { display: block; }

/* Breathing */
.breathing-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
  text-align: center;
}

.breathing-circle {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.breathing-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--lavender);
  transition: transform 4s ease-in-out, border-color 0.5s;
  background: radial-gradient(circle, var(--whisper) 60%, transparent 100%);
}

.breathing-active.inhale .breathing-ring {
  transform: scale(1.25);
  border-color: var(--deep-lavender);
  background: radial-gradient(circle, var(--light-lilac) 60%, transparent 100%);
  transition: transform 4s ease-in-out, border-color 0.5s, background 0.5s;
}

.breathing-active.exhale .breathing-ring {
  transform: scale(0.85);
  border-color: var(--warm-blush);
  background: radial-gradient(circle, #fef6f0 60%, transparent 100%);
  transition: transform 4s ease-in-out, border-color 0.5s, background 0.5s;
}

.breathing-active.hold .breathing-ring {
  border-color: var(--rose-gold);
  transition: transform 0.3s, border-color 0.5s;
}

.breathing-instruction {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.2rem;
}

.breathing-count {
  position: relative;
  z-index: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--deep-lavender);
  line-height: 1;
}

.breathing-controls {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.form-select {
  max-width: 260px;
  padding: 0.65rem 1rem;
}

.breathing-desc {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.7;
  max-width: 400px;
  margin: 0 auto;
}

/* Affirmations */
.affirmations-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
  text-align: center;
}

.affirmation-display {
  min-height: 120px;
  background: linear-gradient(145deg, var(--whisper), var(--light-lilac));
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.affirmation-display:hover { transform: scale(1.01); }

.affirmation-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 500;
  font-style: italic;
  color: var(--dark-plum);
  line-height: 1.6;
  transition: opacity 0.2s;
}

.affirmation-categories {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.cat-btn {
  padding: 0.4rem 1rem;
  border-radius: 100px;
  border: 1.5px solid rgba(184, 169, 201, 0.35);
  background: white;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-btn:hover { border-color: var(--lavender); }
.cat-btn.active { background: var(--whisper); color: var(--deep-lavender); border-color: var(--lavender); font-weight: 600; }

/* 5 Senses */
.senses-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
}

.senses-intro {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.senses-list { display: flex; flex-direction: column; gap: 0.8rem; }

.sense-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  border-radius: 14px;
  background: var(--whisper);
}

.sense-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sense-5 { background: linear-gradient(135deg, var(--light-lilac), white); }
.sense-4 { background: linear-gradient(135deg, var(--blush), white); }
.sense-3 { background: linear-gradient(135deg, #d4f4dd, white); }
.sense-2 { background: linear-gradient(135deg, #fef0d4, white); }
.sense-1 { background: linear-gradient(135deg, #f4e0d4, white); }

.sense-label {
  font-size: 0.92rem;
  color: var(--dark-plum);
  margin-bottom: 0.2rem;
}

.sense-hint { font-size: 0.78rem; color: var(--text-light); line-height: 1.5; }

.senses-close {
  margin-top: 1.5rem;
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
  border-top: 1px solid rgba(184, 169, 201, 0.2);
}

/* ---- COMMUNICATION COACH ---- */
.coach-container { max-width: 720px; margin: 0 auto; }

.coach-header { margin-bottom: 1.8rem; }

.coach-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.3rem;
}

.coach-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

.coach-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.4rem;
}

.coach-preset-btn {
  padding: 0.55rem 1.1rem;
  border-radius: 100px;
  border: 1.5px solid rgba(184, 169, 201, 0.4);
  background: white;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.coach-preset-btn:hover { border-color: var(--lavender); color: var(--dark-plum); background: var(--whisper); }

.coach-preset-btn.active {
  background: var(--deep-lavender);
  color: white;
  border-color: var(--deep-lavender);
}

.coach-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
  margin-bottom: 1.5rem;
}

.coach-preset-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  background: var(--whisper);
  border: 1px solid var(--light-lilac);
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--deep-lavender);
  margin-bottom: 1rem;
}

.coach-input { min-height: 120px; resize: vertical; }

.coach-input-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
  margin-bottom: 1.2rem;
}

.coach-char-count { font-size: 0.75rem; color: var(--text-light); }
.coach-char-warn { color: var(--warm-blush); }

.coach-disclaimer {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: 1rem;
  line-height: 1.6;
}

.coach-thinking { display: flex; justify-content: center; padding: 2rem 0; }

.coach-thinking-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.coach-dots { display: flex; gap: 6px; }

.coach-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lavender);
  animation: bounce 1.2s infinite;
}

.coach-dots span:nth-child(2) { animation-delay: 0.2s; }
.coach-dots span:nth-child(3) { animation-delay: 0.4s; }

.coach-thinking-text {
  font-size: 0.88rem;
  color: var(--text-light);
  font-style: italic;
}

.coach-response-card {
  background: linear-gradient(145deg, var(--whisper), white);
  border: 1px solid rgba(184, 169, 201, 0.25);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.3s ease forwards;
}

.coach-response-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(184, 169, 201, 0.2);
}

.coach-response-icon { font-size: 1.3rem; }

.coach-response-label {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
}

.coach-new-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: 1.5px solid rgba(184, 169, 201, 0.4);
  background: white;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.coach-new-btn:hover { border-color: var(--lavender); background: var(--whisper); }

.coach-response-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.85;
}

.coach-response-text p { margin-bottom: 0.9rem; }
.coach-response-text p:last-child { margin-bottom: 0; }
.coach-response-text strong { font-weight: 600; color: var(--dark-plum); }

.coach-error { color: #c0392b; font-size: 0.88rem; }

.coach-history-section { margin-top: 1rem; }
.coach-history-header { margin-bottom: 0.8rem; }
.coach-history-list { display: flex; flex-direction: column; gap: 0.6rem; }

.coach-history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  background: white;
  border-radius: 14px;
  border: 1px solid rgba(184, 169, 201, 0.15);
}

.coach-history-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }
.coach-history-details { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }

.coach-history-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.coach-history-preset {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--deep-lavender);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.coach-history-time {
  font-size: 0.72rem;
  color: var(--text-light);
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* ---- ONBOARDING ---- */
.ob-main {
  min-height: 100vh;
  padding: 2rem 1.5rem 4rem;
  background: var(--cream);
}

.onboarding-container {
  max-width: 640px;
  margin: 0 auto;
}

/* Step visibility */
.ob-step { animation: fadeInUp 0.3s ease forwards; }
.ob-step.hidden { display: none; }

/* Welcome card */
.ob-welcome-card {
  position: relative;
  background: white;
  border-radius: 28px;
  padding: 3rem 2.5rem;
  box-shadow: 0 8px 48px rgba(139, 123, 168, 0.12);
  text-align: center;
  overflow: hidden;
}

.ob-welcome-glow {
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 200%;
  height: 70%;
  background: radial-gradient(ellipse at center, var(--light-lilac) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.ob-welcome-avatar {
  position: relative;
  z-index: 1;
  font-size: 3rem;
  margin-bottom: 1.2rem;
}

.ob-welcome-title {
  position: relative;
  z-index: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--dark-plum);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.ob-welcome-lede {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 480px;
  margin: 0 auto 2rem;
}

/* Not-therapy disclaimer */
.ob-disclaimer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  background: var(--whisper);
  border: 1px solid var(--light-lilac);
  border-radius: 16px;
  padding: 1.1rem 1.3rem;
  text-align: left;
  margin-bottom: 1.5rem;
}

.ob-disclaimer-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }

.ob-disclaimer p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.ob-disclaimer strong { color: var(--dark-plum); }

/* Privacy row */
.ob-privacy-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.ob-privacy-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ob-start-btn { font-size: 1rem; padding: 1rem 2.5rem; position: relative; z-index: 1; }

.ob-skip-text {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.8rem;
}

/* Quiz card */
.ob-quiz-card {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 4px 32px rgba(139, 123, 168, 0.1);
}

.ob-progress-bar {
  height: 4px;
  background: var(--light-lilac);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.ob-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lavender), var(--deep-lavender));
  border-radius: 2px;
  transition: width 0.4s ease;
}

.ob-step-count {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.ob-question {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--dark-plum);
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.ob-question-sub {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-bottom: 1.8rem;
  line-height: 1.6;
}

/* Option buttons */
.ob-options {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 2rem;
}

.ob-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border: 1.5px solid rgba(184, 169, 201, 0.35);
  border-radius: 16px;
  background: var(--whisper);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  width: 100%;
}

.ob-option-btn:hover {
  border-color: var(--lavender);
  background: white;
}

.ob-option-btn.selected {
  border-color: var(--deep-lavender);
  background: linear-gradient(135deg, var(--whisper), var(--light-lilac));
  box-shadow: 0 2px 12px rgba(139, 123, 168, 0.12);
}

.ob-option-icon { font-size: 1.3rem; flex-shrink: 0; }

.ob-option-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.ob-option-btn.selected .ob-option-label {
  color: var(--dark-plum);
  font-weight: 500;
}

/* Nav row */
.ob-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

/* Results card */
.ob-results-card {
  position: relative;
  background: white;
  border-radius: 28px;
  padding: 3rem 2.5rem;
  box-shadow: 0 8px 48px rgba(139, 123, 168, 0.12);
  text-align: center;
  overflow: hidden;
}

.ob-results-glow {
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 200%;
  height: 60%;
  background: radial-gradient(ellipse at center, var(--blush) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
}

.ob-results-avatar {
  position: relative;
  z-index: 1;
  font-size: 3rem;
  margin-bottom: 1rem;
}

.ob-results-title {
  position: relative;
  z-index: 1;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.8rem;
}

.ob-results-intro {
  position: relative;
  z-index: 1;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 480px;
  margin: 0 auto 2rem;
  font-style: italic;
}

.ob-results-sections {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}

.ob-result-section {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--whisper);
  border: 1px solid var(--light-lilac);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
}

.ob-result-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 0.1rem; }

.ob-result-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  margin-bottom: 0.3rem;
}

.ob-result-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.2rem;
}

.ob-result-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ob-goal-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.ob-goal-tag {
  padding: 0.3rem 0.9rem;
  background: white;
  border: 1px solid var(--lavender);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--deep-lavender);
  font-weight: 500;
}

.ob-results-disclaimer {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.65;
  border-top: 1px solid var(--light-lilac);
  padding-top: 1.5rem;
  margin-bottom: 2rem;
}

.ob-results-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════
   COMPANION CHARACTER
   ════════════════════════════════════════════ */

/* ── Container ── */
.companion-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

/* Size variants */
.companion-size-sm  { width: 72px;  height: 90px;  }
.companion-size-md  { width: 120px; height: 152px; }
.companion-size-lg  { width: 160px; height: 200px; }

.companion-svg { width: 100%; height: 100%; overflow: visible; }

/* ── Idle: gentle float ── */
@keyframes cmp-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ── Idle: subtle breathe (body scale) ── */
@keyframes cmp-breathe {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

/* ── Happy bounce ── */
@keyframes cmp-bounce {
  0%,100% { transform: translateY(0) scale(1); }
  25%      { transform: translateY(-10px) scale(1.04); }
  50%      { transform: translateY(0) scale(0.97); }
  75%      { transform: translateY(-5px) scale(1.02); }
}

/* ── Proud pulse (subtle glow-ring rotate + scale) ── */
@keyframes cmp-proud-ring {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Grounding: slow sway ── */
@keyframes cmp-sway {
  0%,100% { transform: rotate(0deg); }
  33%      { transform: rotate(2.5deg); }
  66%      { transform: rotate(-2.5deg); }
}

/* ── Thinking: subtle tilt ── */
@keyframes cmp-tilt {
  0%,100% { transform: rotate(0deg); }
  30%      { transform: rotate(-3deg); }
  70%      { transform: rotate(3deg); }
}

/* ── Comforting: soft pulse glow ── */
@keyframes cmp-glow-pulse {
  0%,100% { opacity: 0.55; r: 66; }
  50%      { opacity: 0.9;  r: 72; }
}

/* ── Sparkle twinkle ── */
@keyframes cmp-sparkle-spin {
  0%   { transform: rotate(0deg) scale(1);   opacity: 0.7; }
  50%  { transform: rotate(180deg) scale(1.3); opacity: 1; }
  100% { transform: rotate(360deg) scale(1);   opacity: 0.7; }
}

/* ── Breath dots ── */
@keyframes cmp-breath-dot {
  0%,100% { transform: scale(1);    opacity: 0.5; }
  50%      { transform: scale(1.6);  opacity: 1;   }
}

/* ── Listening: attentive lean-in ── */
@keyframes cmp-lean {
  0%,100% { transform: rotate(0deg) translateX(0); }
  40%      { transform: rotate(4deg) translateX(3px); }
  80%      { transform: rotate(-1deg) translateX(-1px); }
}

/* ── Tired: slow droopy sink ── */
@keyframes cmp-droop {
  0%,100% { transform: translateY(0) scaleY(1); }
  50%      { transform: translateY(4px) scaleY(0.97); }
}

/* ── Neglected: sad side-to-side look-around ── */
@keyframes cmp-look-around {
  0%,100% { transform: rotate(0deg); }
  20%      { transform: rotate(-4deg) translateX(-3px); }
  60%      { transform: rotate(4deg) translateX(3px); }
  80%      { transform: rotate(-2deg) translateX(-1px); }
}

/* ── Gaming: fast excited jitter ── */
@keyframes cmp-gaming-shake {
  0%,100% { transform: translateX(0) translateY(0); }
  25%      { transform: translateX(-2px) translateY(-1px); }
  75%      { transform: translateX(2px) translateY(1px); }
}

/* ── Evolving: magical glow pulse ── */
@keyframes cmp-evolve-pulse {
  0%,100% { transform: scale(1);      filter: brightness(1); }
  50%      { transform: scale(1.035); filter: brightness(1.08); }
}

/* ── State transition ── */
.companion-wrap .companion-svg * {
  transition: opacity 0.25s ease, transform 0.3s ease;
}

/* ── Base idle animation applied to the whole SVG wrapper ── */
.companion-wrap[data-state="neutral"]    .companion-svg { animation: cmp-float 4s ease-in-out infinite; }
.companion-wrap[data-state="happy"]      .companion-svg { animation: cmp-bounce 0.8s ease-in-out 3, cmp-float 4s ease-in-out infinite 2.4s; }
.companion-wrap[data-state="comforting"] .companion-svg { animation: cmp-float 5s ease-in-out infinite; }
.companion-wrap[data-state="thinking"]   .companion-svg { animation: cmp-tilt 2.5s ease-in-out infinite; }
.companion-wrap[data-state="concerned"]  .companion-svg { animation: cmp-float 6s ease-in-out infinite; }
.companion-wrap[data-state="grounding"]  .companion-svg { animation: cmp-sway 6s ease-in-out infinite; }
.companion-wrap[data-state="proud"]      .companion-svg { animation: cmp-bounce 0.7s ease-in-out 4, cmp-float 4s ease-in-out infinite 2.8s; }
.companion-wrap[data-state="checkin"]    .companion-svg { animation: cmp-float 4.5s ease-in-out infinite; }
.companion-wrap[data-state="listening"]  .companion-svg { animation: cmp-lean 3s ease-in-out infinite; }
.companion-wrap[data-state="tired"]      .companion-svg { animation: cmp-droop 6s ease-in-out infinite; }
.companion-wrap[data-state="neglected"]  .companion-svg { animation: cmp-look-around 5s ease-in-out infinite; }
.companion-wrap[data-state="gaming"]     .companion-svg { animation: cmp-gaming-shake 0.18s ease-in-out 6, cmp-bounce 0.9s ease-in-out 3 1.1s, cmp-float 4s ease-in-out infinite 3.8s; }
.companion-wrap[data-state="evolving"]   .companion-svg { animation: cmp-evolve-pulse 2.8s ease-in-out infinite; }

/* ── Body breathe on idle states ── */
.companion-wrap[data-state="neutral"]    .companion-body-group,
.companion-wrap[data-state="checkin"]    .companion-body-group,
.companion-wrap[data-state="comforting"] .companion-body-group,
.companion-wrap[data-state="grounding"]  .companion-body-group,
.companion-wrap[data-state="tired"]      .companion-body-group {
  animation: cmp-breathe 4s ease-in-out infinite;
}

/* ── Cheek color per state ── */
.companion-wrap[data-state="happy"]      .companion-cheek-l,
.companion-wrap[data-state="happy"]      .companion-cheek-r,
.companion-wrap[data-state="proud"]      .companion-cheek-l,
.companion-wrap[data-state="proud"]      .companion-cheek-r {
  fill: url(#cmp-cheek-l);
  opacity: 1;
}
.companion-wrap[data-state="neutral"]    .companion-cheek-l,
.companion-wrap[data-state="neutral"]    .companion-cheek-r {
  opacity: 0.6;
}

/* ── Aura color per state ── */
.companion-wrap[data-state="comforting"] .companion-aura { fill: #fef0f8; opacity: 0.9; }
.companion-wrap[data-state="grounding"]  .companion-aura { fill: #e8f4f0; opacity: 0.9; }
.companion-wrap[data-state="proud"]      .companion-aura { fill: #fef6e8; opacity: 0.9; }
.companion-wrap[data-state="happy"]      .companion-aura { fill: #fef8f0; opacity: 0.9; }
.companion-wrap[data-state="thinking"]   .companion-aura { opacity: 0.5; }
.companion-wrap[data-state="concerned"]  .companion-aura { fill: #f0eef8; opacity: 0.8; }
.companion-wrap[data-state="tired"]      .companion-aura { fill: #ece8f4; opacity: 0.55; }
.companion-wrap[data-state="neglected"]  .companion-aura { fill: #e8eef8; opacity: 0.65; }
.companion-wrap[data-state="gaming"]     .companion-aura { fill: #f4eeff; opacity: 1; }
.companion-wrap[data-state="evolving"]   .companion-aura { fill: #f0e4ff; opacity: 1; animation: cmp-glow-pulse 2.2s ease-in-out infinite; }

/* ── Glow ring spin (proud / evolving) ── */
.companion-wrap[data-state="proud"] .companion-glow-ring,
.companion-wrap[data-state="evolving"] .companion-glow-ring {
  display: block !important;
  animation: cmp-proud-ring 8s linear infinite;
  transform-origin: 80px 98px;
}
.companion-wrap[data-state="evolving"] .companion-glow-ring {
  stroke: #c090e8;
  animation: cmp-proud-ring 4s linear infinite;
  stroke-opacity: 0.45;
}

/* ── Sparkles (happy, proud, gaming) ── */
.companion-wrap[data-state="happy"]   .companion-sparkles,
.companion-wrap[data-state="proud"]   .companion-sparkles,
.companion-wrap[data-state="gaming"]  .companion-sparkles {
  display: block !important;
}
.cmp-sparkle-1 { animation: cmp-sparkle-spin 1.8s ease-in-out infinite; transform-origin: 132px 50px; }
.cmp-sparkle-2 { animation: cmp-sparkle-spin 2.2s ease-in-out 0.4s infinite; transform-origin: 27.5px 59.5px; }
.cmp-sparkle-3 { animation: cmp-sparkle-spin 1.6s ease-in-out 0.8s infinite; transform-origin: 136px 78px; }

/* ── Lotus (grounding) ── */
.companion-wrap[data-state="grounding"] .companion-lotus {
  display: block !important;
}

/* ── Breath dots (grounding) ── */
.companion-wrap[data-state="grounding"] .companion-breath-dots {
  display: block !important;
}
.cmp-bdot-1 { animation: cmp-breath-dot 3s ease-in-out infinite; }
.cmp-bdot-2 { animation: cmp-breath-dot 3s ease-in-out 0.3s infinite; }
.cmp-bdot-3 { animation: cmp-breath-dot 3s ease-in-out 0.6s infinite; }

/* ── Head group tilt (thinking) ── */
.companion-wrap[data-state="thinking"] .companion-head-group {
  animation: cmp-tilt 2.8s ease-in-out infinite;
  transform-origin: 80px 74px;
}

/* ══════════════════════════════════════════
   COMPANION PANEL LAYOUTS (per page)
   ══════════════════════════════════════════ */

/* Chat layout — companion floats in header */
.chat-companion-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(184, 169, 201, 0.2);
  flex-shrink: 0;
}

.chat-companion-info { flex: 1; }

/* Sidebar layout (wider screens) */
.companion-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 1.5rem 1rem;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
  min-width: 140px;
}

.companion-sidebar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  text-align: center;
}

.companion-state-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--deep-lavender);
  background: var(--whisper);
  border: 1px solid var(--light-lilac);
  border-radius: 100px;
  padding: 0.2rem 0.7rem;
  text-align: center;
  text-transform: capitalize;
  transition: all 0.3s ease;
}

/* ── Companion floating banner for check-in / coach / grounding ── */
.companion-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  border-radius: 20px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 4px 24px rgba(139, 123, 168, 0.08);
  margin-bottom: 1.5rem;
}

.companion-banner-text {
  flex: 1;
}

.companion-banner-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.2rem;
}

.companion-banner-msg {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  font-style: italic;
  transition: opacity 0.3s ease;
}

/* ════════════════════════════════════════════
   PAGE TRANSITIONS
   ════════════════════════════════════════════ */
.app-main {
  animation: pageEnter 0.22s ease forwards;
}

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

/* ════════════════════════════════════════════
   TOUCH MICRO-INTERACTIONS
   ════════════════════════════════════════════ */

/* Tap feedback — active scale on all interactive elements */
.btn-primary:active,
.btn-secondary:active,
.chat-send-btn:active,
.chat-mic-btn:active,
.mood-btn:active,
.tool-tab:active,
.cat-btn:active,
.coach-preset-btn:active,
.ob-option-btn:active {
  transform: scale(0.96) !important;
  transition: transform 0.08s ease !important;
}

/* Ripple-style tap highlight override for mobile */
@media (hover: none) {
  .btn-primary:hover,
  .btn-secondary:hover,
  .chat-send-btn:hover,
  .mood-btn:hover,
  .tool-tab:hover,
  .ob-option-btn:hover {
    transform: none;
  }
}

/* Prevent text selection on tap for interactive elements */
.mood-btn, .tool-tab, .cat-btn, .coach-preset-btn, .ob-option-btn,
.btn-primary, .btn-secondary, .chat-send-btn, .chat-mic-btn, .voice-stop-btn {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ════════════════════════════════════════════
   BOTTOM TAB BAR (mobile only)
   ════════════════════════════════════════════ */
.bottom-nav {
  display: none; /* hidden on desktop */
}

/* ════════════════════════════════════════════
   RESPONSIVE — DESKTOP FIRST BASELINE
   ════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* ── App shell ── */
  .app-nav { padding: 0.8rem 1rem; }
  .app-nav-links { gap: 0.2rem; }
  .app-nav-link { padding: 0.4rem 0.7rem; font-size: 0.78rem; }

  /* On mobile: hide top nav links, show bottom nav instead */
  .app-nav-links { display: none; }

  /* Add bottom padding to main so content clears bottom nav */
  .app-main { padding: 1rem 1rem 5.5rem; }

  /* ── Bottom tab nav ── */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(250, 246, 241, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(184, 169, 201, 0.25);
    padding: 0.4rem 0 env(safe-area-inset-bottom, 0.4rem);
    /* Safe area for iPhone notch */
    padding-bottom: max(env(safe-area-inset-bottom), 0.4rem);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.4rem 0.2rem;
    text-decoration: none;
    color: var(--text-light);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .bottom-nav-item.active {
    color: var(--deep-lavender);
  }

  .bottom-nav-item:active {
    transform: scale(0.92);
    transition: transform 0.08s ease;
  }

  .bottom-nav-icon {
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.2s ease;
  }

  .bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.15);
  }

  .bottom-nav-label {
    line-height: 1;
  }

  /* Active indicator dot */
  .bottom-nav-item.active::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--deep-lavender);
    margin-top: 0.1rem;
  }

  /* ── Chat ── */
  /* Full viewport height minus top nav and bottom tab bar */
  .chat-container {
    height: calc(100dvh - 56px - 64px);
    /* dvh = dynamic viewport height (accounts for browser chrome) */
  }

  /* Fixed input bar at bottom (above bottom nav) */
  .chat-input-area {
    position: sticky;
    bottom: 0;
    background: rgba(250, 246, 241, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.8rem 0 0.5rem;
    margin: 0 -0 0;
    border-top: 1px solid rgba(184, 169, 201, 0.2);
  }

  /* Larger tap targets for chat send + mic */
  .chat-send-btn,
  .chat-mic-btn {
    width: 48px;
    height: 48px;
  }

  /* ── Mood picker — bigger tap targets on mobile ── */
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
  }

  .mood-btn {
    padding: 0.85rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 14px;
    min-height: 56px; /* 56px minimum tap target */
  }

  /* Intensity slider — bigger thumb on touch */
  .intensity-slider {
    height: 8px;
  }
  .intensity-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }
  .intensity-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--deep-lavender);
    cursor: pointer;
    border: 2px solid white;
  }

  /* ── Check-in cards ── */
  .checkin-card, .breathing-card, .affirmations-card, .senses-card { padding: 1.3rem; }

  /* ── Communication Coach — collapsible presets ── */
  .coach-presets {
    gap: 0.4rem;
    /* Horizontal scroll on mobile instead of wrap */
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.2rem;
  }
  .coach-presets::-webkit-scrollbar { display: none; }

  .coach-preset-btn {
    font-size: 0.8rem;
    padding: 0.55rem 0.95rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 40px;
  }

  .coach-card { padding: 1.3rem; }
  .coach-response-card { padding: 1.3rem; }
  .coach-input { min-height: 100px; }

  /* ── Grounding — full-width breathing circle ── */
  .breathing-card { padding: 1.5rem 1rem; }

  .breathing-circle {
    width: 240px;
    height: 240px;
  }

  .tool-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.2rem;
  }
  .tool-tabs::-webkit-scrollbar { display: none; }
  .tool-tab { flex-shrink: 0; min-height: 40px; }

  /* ── Onboarding ── */
  .ob-welcome-card, .ob-quiz-card, .ob-results-card { padding: 1.8rem 1.3rem; }
  .ob-welcome-title { font-size: 1.8rem; }
  .ob-question { font-size: 1.4rem; }
  .ob-nav { flex-direction: column-reverse; }
  .ob-nav .btn-primary, .ob-nav .btn-secondary { width: 100%; text-align: center; }

  /* Bigger tap targets for onboarding options */
  .ob-option-btn { padding: 1.1rem 1.2rem; min-height: 60px; }

  /* ── Affirmation display bigger on mobile ── */
  .affirmation-display { min-height: 140px; }
  .affirmation-text { font-size: 1.15rem; }

  /* ── Companion sizing on mobile ── */
  .companion-size-md { width: 90px; height: 114px; }

  /* ── Companion banner compact ── */
  .companion-banner { padding: 1rem 1.2rem; }

  /* ── Recent items — larger touch area ── */
  .recent-item { padding: 1rem 1.2rem; }

  /* ── Coach history items ── */
  .coach-history-item { padding: 1rem 1.2rem; }
}

/* ── Slightly larger than 600px but still tablet/small ── */
@media (max-width: 768px) and (min-width: 601px) {
  .app-main { padding: 1.2rem 1.5rem; }
  .chat-container { height: calc(100dvh - 65px); }
  .mood-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── iPhone landscape and small phones ── */
@media (max-width: 600px) and (orientation: landscape) {
  .bottom-nav { padding-bottom: 0.2rem; }
  .app-main { padding-bottom: 4.5rem; }
  .chat-container { height: calc(100dvh - 56px - 56px); }
  .breathing-circle { width: 160px; height: 160px; margin-bottom: 1rem; }
  .ob-welcome-card, .ob-quiz-card { padding: 1.2rem; }
  .ob-welcome-title { font-size: 1.5rem; }
}

/* ── Safe area / notch support ── */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 600px) {
    .app-main {
      padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
  }
}

/* ---- PERSONAL GROWTH DASHBOARD ---- */
.dashboard-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dashboard-header {
  text-align: center;
  padding-bottom: 0.25rem;
}

.dashboard-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.3rem;
}

.dashboard-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Stat cards grid */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background: var(--whisper);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid rgba(184, 169, 201, 0.18);
  transition: transform 0.15s;
}

.stat-card:active { transform: scale(0.97); }

.stat-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.stat-value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--dark-plum);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Accent tints per stat card */
.stat-card--streak   { border-left: 3px solid #e8c4c4; }
.stat-card--longest  { border-left: 3px solid #c4937a; }
.stat-card--checkins { border-left: 3px solid #b8a9c9; }
.stat-card--coach    { border-left: 3px solid #8b7ba8; }

/* Dashboard card (chart + insight) */
.dashboard-card {
  background: #ffffff;
  border-radius: 20px;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid rgba(184, 169, 201, 0.2);
  box-shadow: 0 2px 12px rgba(139, 123, 168, 0.07);
}

.dashboard-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dashboard-card-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--dark-plum);
}

.dashboard-card-caption {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Chart */
.chart-wrapper {
  width: 100%;
  position: relative;
  min-height: 100px;
}

#mood-chart {
  width: 100%;
  height: 120px;
  display: block;
}

.chart-empty {
  display: none;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 1.5rem 0;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot--positive { background: #d4a0a0; }
.legend-dot--neutral  { background: #8b7ba8; }
.legend-dot--low      { background: #6b5b7b; }

.legend-label {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-right: 0.5rem;
}

/* AI Insight card */
.insight-card {
  background: linear-gradient(135deg, var(--whisper) 0%, #fff 100%);
  position: relative;
  padding-top: 1.5rem;
}

.insight-sparkle {
  position: absolute;
  top: -0.65rem;
  left: 1.25rem;
  font-size: 1.2rem;
  color: var(--deep-lavender);
  background: var(--whisper);
  padding: 0 0.3rem;
  line-height: 1;
}

.insight-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--deep-lavender);
  margin-bottom: 0.6rem;
}

.insight-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.65;
}

/* Empty state CTA */
.dashboard-cta {
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  padding: 1rem 0;
}

.dashboard-cta-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 400px) {
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.4rem; }
  .dashboard-title { font-size: 1.7rem; }
}

/* ---- UPGRADE PROMPT (free tier limit) ---- */
.upgrade-prompt {
  background: linear-gradient(135deg, var(--whisper), #fef6f0) \!important;
  border: 1.5px solid rgba(184, 169, 201, 0.35) \!important;
}

.upgrade-btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  background: linear-gradient(135deg, var(--deep-lavender), var(--soft-plum));
  color: white;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(139, 123, 168, 0.28);
}

.upgrade-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ──────────────────────────────────────────────────────────────────────────
   COMPANION CARE SYSTEM — energy bar, evolution layers, neglect banner
   ────────────────────────────────────────────────────────────────────────── */

/* ── Animations for care states ── */
@keyframes tireDroop {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(3px); }
}
@keyframes missingPulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; }
}
@keyframes stageGlow {
  0%, 100% { stroke-opacity: 0.3; }
  50%       { stroke-opacity: 0.7; }
}
@keyframes stage4StarTwinkle {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.25); }
}
@keyframes stage5GemPulse {
  0%, 100% { fill-opacity: 0.9; }
  50%       { fill-opacity: 0.5; }
}

/* Tired companion — whole character droops subtly */
.companion-wrap[data-state="tired"] .companion-head-group {
  animation: tireDroop 3s ease-in-out infinite;
  transform-origin: 80px 74px;
}

/* Missing companion — gentle pulse on the aura */
.companion-wrap[data-state="missing"] .companion-aura {
  animation: missingPulse 2.5s ease-in-out infinite;
}
.companion-wrap[data-state="missing"] .companion-body {
  opacity: 0.85;
}

/* ── Evolution visual layers (hidden by default, shown by data-stage) ── */
.cmp-evolution { display: none; }

/* Stage 2: heart accessory (bond 3+) */
.companion-wrap[data-stage="2"] .cmp-stage-2,
.companion-wrap[data-stage="3"] .cmp-stage-2,
.companion-wrap[data-stage="4"] .cmp-stage-2,
.companion-wrap[data-stage="5"] .cmp-stage-2 { display: block; }

/* Stage 3: warm glow ring (bond 5+) */
.companion-wrap[data-stage="3"] .cmp-stage-3,
.companion-wrap[data-stage="4"] .cmp-stage-3,
.companion-wrap[data-stage="5"] .cmp-stage-3 { display: block; }

.cmp-stage3-ring { animation: stageGlow 3s ease-in-out infinite; }

/* Stage 4: sparkle stars + aura (bond 7+) */
.companion-wrap[data-stage="4"] .cmp-stage-4,
.companion-wrap[data-stage="5"] .cmp-stage-4 { display: block; }

.cmp-stage4-star1 { animation: stage4StarTwinkle 2.2s ease-in-out infinite; transform-origin: 144.5px 36.5px; }
.cmp-stage4-star2 { animation: stage4StarTwinkle 1.8s ease-in-out infinite 0.6s; transform-origin: 17px 56px; }
.cmp-stage4-aura  { animation: stageGlow 4s ease-in-out infinite; }

/* Stage 5: golden crown + radiant glow (bond 10) */
.companion-wrap[data-stage="5"] .cmp-stage-5 { display: block; }

.cmp-stage5-gem { animation: stage5GemPulse 2s ease-in-out infinite; }

/* ── Energy bar widget ── */
.care-energy-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.5rem;
  width: 100%;
  max-width: 160px;
  margin-left: auto;
  margin-right: auto;
}

.care-energy-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.care-energy-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.care-energy-track {
  flex: 1;
  height: 6px;
  background: rgba(184, 169, 201, 0.2);
  border-radius: 100px;
  overflow: hidden;
}

.care-energy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lavender), var(--deep-lavender));
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.care-energy-fill--low {
  background: linear-gradient(90deg, #c4937a, #e0a898);
}

.care-energy-pct {
  font-size: 0.72rem;
  color: var(--text-light);
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
  font-weight: 500;
}

/* ── Neglect banner ── */
.care-neglect-banner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: linear-gradient(135deg, #fef6f0, #fff0f5);
  border: 1.5px solid rgba(212, 169, 160, 0.45);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  animation: fadeInUp 0.35s ease forwards;
}

.care-neglect-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.care-neglect-body {
  flex: 1;
  font-size: 0.87rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.care-neglect-cta {
  display: inline-block;
  padding: 0.5rem 1.1rem;
  background: var(--deep-lavender);
  color: white;
  border-radius: 100px;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}
.care-neglect-cta:hover {
  background: var(--soft-plum);
  transform: translateY(-1px);
}

/* ── Dashboard companion care card ── */
.companion-care-card {
  background: linear-gradient(135deg, var(--whisper), #fef6f8);
  border: 1.5px solid rgba(184, 169, 201, 0.3);
  border-radius: 20px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.2rem;
}

.companion-care-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.companion-care-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark-plum);
}

.companion-care-stage {
  font-size: 0.8rem;
  color: var(--text-light);
  background: rgba(139, 123, 168, 0.1);
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  font-weight: 500;
}

.companion-care-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.care-stat {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.care-stat-label {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.care-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-plum);
}

.care-energy-bar-lg {
  margin-top: 0.4rem;
  height: 8px;
  background: rgba(184, 169, 201, 0.2);
  border-radius: 100px;
  overflow: hidden;
}

.care-energy-bar-lg .care-energy-fill {
  height: 100%;
}

@media (max-width: 480px) {
  .care-neglect-banner { flex-wrap: wrap; }
  .companion-care-body { grid-template-columns: 1fr; }
}

/* ---- FEEDBACK WIDGET ---- */
#amica-feedback-widget {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  right: 1.25rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.afb-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--deep-lavender);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(139, 123, 168, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  outline: none;
  user-select: none;
}
.afb-bubble:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(139, 123, 168, 0.55); }
.afb-bubble:active { transform: scale(0.96); }

.afb-panel {
  background: white;
  border: 1.5px solid rgba(184, 169, 201, 0.35);
  border-radius: 20px;
  padding: 1.25rem;
  width: 280px;
  box-shadow: 0 8px 40px rgba(61, 47, 74, 0.12);
}

.afb-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.afb-panel-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  color: var(--dark-plum);
  font-weight: 500;
}

.afb-close {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  transition: background 0.2s;
}
.afb-close:hover { background: var(--whisper); }

.afb-emojis {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.afb-emoji-btn {
  background: var(--whisper);
  border: 2px solid transparent;
  border-radius: 12px;
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.afb-emoji-btn:hover { transform: scale(1.12); background: var(--light-lilac); }
.afb-emoji-btn.selected { border-color: var(--deep-lavender); background: var(--light-lilac); }

.afb-text {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid rgba(184, 169, 201, 0.4);
  border-radius: 12px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.87rem;
  color: var(--text-primary);
  background: white;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
  margin-bottom: 0.85rem;
}
.afb-text:focus { border-color: var(--deep-lavender); }

.afb-submit {
  width: 100%;
  padding: 0.65rem;
  background: var(--deep-lavender);
  color: white;
  border: none;
  border-radius: 100px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.afb-submit:hover { opacity: 0.92; transform: translateY(-1px); }
.afb-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.afb-thanks {
  text-align: center;
  color: var(--soft-plum);
  font-size: 0.88rem;
  margin-top: 0.5rem;
}

@media (min-width: 768px) {
  #amica-feedback-widget { bottom: 1.5rem; }
}

/* ---- ANALYTICS ADMIN PAGE ---- */
.analytics-admin {
  max-width: 900px;
  margin: 0 auto;
  padding-bottom: 3rem;
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.analytics-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--dark-plum);
}

.analytics-window-selector {
  display: flex;
  gap: 0.4rem;
}

.an-win-btn {
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--whisper);
  transition: background 0.2s, color 0.2s;
}
.an-win-btn:hover { background: var(--light-lilac); color: var(--dark-plum); }
.an-win-btn.active { background: var(--deep-lavender); color: white; }

.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.an-kpi-card {
  background: white;
  border: 1.5px solid rgba(184, 169, 201, 0.25);
  border-radius: 16px;
  padding: 1.2rem 1rem;
  text-align: center;
}

.an-kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark-plum);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.an-kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.an-section {
  background: white;
  border: 1.5px solid rgba(184, 169, 201, 0.25);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.an-section-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--dark-plum);
  margin-bottom: 0.6rem;
}

.an-section-sub {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 0.85rem;
}

.an-chart-wrap {
  position: relative;
}

.an-sparkline {
  width: 100%;
  height: 80px;
  display: block;
}

.an-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

.an-feature-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.an-feature-row {
  display: grid;
  grid-template-columns: 110px 1fr 160px;
  align-items: center;
  gap: 0.75rem;
}

.an-feature-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.an-feature-bar-wrap {
  height: 8px;
  background: var(--whisper);
  border-radius: 100px;
  overflow: hidden;
}

.an-feature-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--deep-lavender), var(--lavender));
  border-radius: 100px;
  min-width: 4px;
  transition: width 0.4s ease;
}

.an-feature-stats {
  display: flex;
  gap: 0.5rem;
  font-size: 0.78rem;
  justify-content: flex-end;
}

.an-stat-events { color: var(--dark-plum); font-weight: 600; }
.an-stat-users { color: var(--text-light); }

.an-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.an-retention-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.an-ret-card {
  background: var(--whisper);
  border-radius: 12px;
  padding: 0.85rem 0.5rem;
  text-align: center;
}

.an-ret-pct {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--deep-lavender);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.an-ret-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.an-ret-raw {
  font-size: 0.72rem;
  color: var(--text-light);
}

.an-depth-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.an-depth-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  align-items: center;
  gap: 0.65rem;
}

.an-depth-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.an-depth-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--dark-plum);
  text-align: right;
}

.an-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.an-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid rgba(184, 169, 201, 0.2);
}

.an-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(184, 169, 201, 0.1);
  color: var(--text-primary);
}

.an-table tr:last-child td { border-bottom: none; }
.an-table tr:hover td { background: var(--whisper); }

.an-category-badge {
  background: var(--light-lilac);
  color: var(--soft-plum);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.an-feedback-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.an-feedback-card {
  background: var(--whisper);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}

.an-feedback-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}

.an-fb-emoji { font-size: 1.3rem; }

.an-fb-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: capitalize;
}

.an-fb-time {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-left: auto;
}

.an-fb-message {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.55;
  font-style: italic;
}

.an-empty {
  font-size: 0.88rem;
  color: var(--text-light);
  font-style: italic;
  padding: 0.5rem 0;
}

.an-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.an-footer a { color: var(--deep-lavender); text-decoration: none; }
.an-footer a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .an-two-col { grid-template-columns: 1fr; }
  .an-feature-row { grid-template-columns: 90px 1fr; }
  .an-feature-stats { display: none; }
  .an-retention-grid { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
}
