:root {
  --primary: #D4836B;
  --primary-light: #E8A87C;
  --primary-soft: #F5D5C8;
  --secondary: #C9A0DC;
  --secondary-light: #E0C3F0;
  --accent: #F9D5A7;
  --accent-warm: #F4A261;
  --bg: #FFF8F0;
  --bg-warm: #FFF3E8;
  --bg-card: #FFFFFF;
  --text: #4A3728;
  --text-light: #8B7355;
  --text-muted: #B8A08A;
  --border: #F0E0D0;
  --shadow: 0 2px 16px rgba(180, 120, 80, 0.08);
  --shadow-lg: 0 8px 32px rgba(180, 120, 80, 0.12);
  --shadow-glow: 0 0 40px rgba(212, 131, 107, 0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 9999px;
  --sidebar-width: 180px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --emotion-happy: #FFB347;
  --emotion-sad: #7BA7D0;
  --emotion-angry: #E07A5F;
  --emotion-fearful: #9B8EC2;
  --emotion-peaceful: #81B29A;
  --emotion-hopeful: #F2CC8F;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* --- AUTH MODAL --- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(74, 55, 40, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  animation: authFadeIn 0.3s ease;
}

@keyframes authFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-container {
  position: relative;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 16px 64px rgba(180, 120, 80, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: authSlideUp 0.35s ease;
}

@keyframes authSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.auth-close-btn:hover {
  background: var(--border);
  color: var(--text);
}

.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}

.auth-brand-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 8px;
  color: var(--primary);
  filter: drop-shadow(0 3px 10px rgba(212, 131, 107, 0.35));
}

.auth-brand h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-full);
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.auth-form {
  animation: fadeIn 0.3s ease;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: white;
  transition: border-color var(--transition);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.auth-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.strength-bar {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}

.strength-label {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 55px;
  text-align: right;
}

.password-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 8px;
}

.password-rules .rule {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.password-rules .rule.pass {
  color: #2A9D8F;
}

.turnstile-box {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  min-height: 65px;
}

.auth-error {
  color: #C0392B;
  font-size: 0.85rem;
  text-align: center;
  min-height: 20px;
  margin-bottom: 8px;
  font-weight: 500;
}

.auth-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(212, 131, 107, 0.3);
}

.auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 131, 107, 0.4);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-submit svg {
  width: 18px;
  height: 18px;
}

.auth-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 20px;
  line-height: 1.5;
}

/* --- SIDEBAR USER --- */
.sidebar-user {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.user-greeting {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
}

.user-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--primary);
}

.logout-btn {
  color: var(--text-muted) !important;
  font-size: 0.8rem !important;
}

.logout-btn:hover {
  color: #C0392B !important;
  background: #FDEDEC !important;
}

.sidebar-signin {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.signin-btn {
  background: linear-gradient(135deg, var(--primary-soft), var(--secondary-light)) !important;
  font-weight: 600 !important;
}

.signin-btn:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary)) !important;
  color: white !important;
}

@media (max-width: 480px) {
  .auth-container {
    margin: 16px;
    padding: 28px 20px;
  }
}

/* --- CRISIS BANNER --- */
.crisis-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5000;
  background: linear-gradient(135deg, #FFE8E0, #FFD4C4);
  border-bottom: 2px solid #E07A5F;
  box-shadow: 0 4px 24px rgba(224, 122, 95, 0.2);
}

.crisis-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.crisis-banner-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: #C0392B;
  animation: crisisPulse 2s ease-in-out infinite;
}

@keyframes crisisPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.crisis-banner-text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #4A2020;
}

.crisis-banner-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.crisis-country {
  font-weight: 600;
}

.crisis-number {
  color: #C0392B;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid #C0392B;
}

.crisis-number:hover {
  color: #922B21;
}

.crisis-more-btn {
  background: none;
  border: none;
  color: #C0392B;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 8px;
}

.crisis-banner-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #8B4040;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.crisis-banner-close:hover {
  opacity: 1;
}

.crisis-animate {
  animation: crisisSlideIn 0.5s ease;
}

@keyframes crisisSlideIn {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* --- CRISIS HELP SIDEBAR BUTTON --- */
.crisis-help-btn {
  margin-top: 8px;
  color: #C0392B !important;
  border: 1px dashed #E6B0AA;
  border-radius: var(--radius-sm);
  background: #FFF5F3 !important;
}

.crisis-help-btn:hover {
  background: #FDEDEC !important;
  border-color: #C0392B;
}

/* --- CRISIS MODAL --- */
.crisis-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.crisis-modal {
  background: white;
  border-radius: 20px;
  padding: 36px 32px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: crisisModalIn 0.4s ease;
}

@keyframes crisisModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.crisis-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.crisis-modal-close:hover {
  color: var(--text);
}

.crisis-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.crisis-modal-header h2 {
  font-size: 1.4rem;
  color: var(--text);
  margin: 12px 0 6px;
}

.crisis-modal-header p {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
}

.crisis-modal-local,
.crisis-modal-international {
  margin-bottom: 20px;
}

.crisis-modal-local h3,
.crisis-modal-international h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-soft);
}

.crisis-line-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.crisis-line-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.crisis-line-number {
  font-weight: 700;
  font-size: 1rem;
  color: #C0392B;
  text-decoration: none;
}

.crisis-line-number:hover {
  text-decoration: underline;
}

.crisis-line-note {
  width: 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.crisis-modal-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  font-weight: 500;
}

@media (max-width: 480px) {
  .crisis-modal {
    margin: 12px;
    padding: 24px 18px;
  }

  .crisis-banner-inner {
    padding: 10px 16px;
    flex-wrap: wrap;
  }
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 10px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  text-align: center;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 4px;
  color: var(--primary);
  filter: drop-shadow(0 2px 8px rgba(212, 131, 107, 0.3));
}

.brand-name {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.brand-tagline {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-btn:hover {
  background: var(--bg-warm);
  color: var(--primary);
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-toggle-mobile {
  display: none;
}

.mobile-tabs {
  display: none;
}

.mobile-more-menu {
  display: none;
}

/* --- MAIN CONTENT --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.view {
  display: none;
  padding: 40px;
  max-width: 960px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  margin-bottom: 32px;
}

.view-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.view-header p {
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1.6;
}

/* --- HOME --- */
.home-hero {
  text-align: center;
  padding: 40px 0;
  position: relative;
}

.hero-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(232, 168, 124, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
  position: relative;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-light);
  max-width: 520px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  color: var(--text);
  box-shadow: var(--shadow);
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.action-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.action-icon svg {
  width: 28px;
  height: 28px;
}

.action-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.action-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
}

.daily-affirmation {
  background: linear-gradient(135deg, var(--primary-soft), var(--secondary-light));
  border-radius: var(--radius);
  padding: 24px 32px;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.affirmation-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
  opacity: 0.7;
}

.daily-affirmation p {
  font-size: 1.05rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.6;
  font-weight: 500;
}

/* --- CHECK-IN --- */
.checkin-step {
  display: none;
  animation: fadeIn 0.4s ease;
}

.checkin-step.active {
  display: block;
}

.step-label {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.emotion-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.emotion-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.emotion-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-glow);
}

.emotion-emoji {
  font-size: 2.2rem;
  margin-bottom: 8px;
  display: block;
}

.emotion-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.sub-emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sub-emotion-btn {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  transition: all var(--transition);
}

.sub-emotion-btn:hover {
  border-color: var(--primary-light);
  background: var(--bg-warm);
}

.sub-emotion-btn.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.skip-btn {
  display: block;
  margin: 16px auto 0;
  padding: 8px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  transition: color var(--transition);
}

.skip-btn:hover { color: var(--text-light); }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color var(--transition);
}

.back-btn:hover { color: var(--text); }
.back-btn svg { width: 16px; height: 16px; }

.intensity-container {
  max-width: 400px;
  margin: 0 auto 24px;
  text-align: center;
}

.intensity-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.intensity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: linear-gradient(to right, var(--emotion-peaceful), var(--accent-warm), var(--emotion-angry));
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.intensity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 3px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.2s;
}

.intensity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.intensity-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 8px;
}

.trigger-section {
  margin-bottom: 16px;
}

.trigger-section label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.trigger-section textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-card);
  resize: vertical;
  transition: border-color var(--transition);
}

.trigger-section textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(212, 131, 107, 0.3);
  margin-top: 8px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212, 131, 107, 0.4);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.primary-btn svg { width: 18px; height: 18px; }

.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
  margin-left: 12px;
}

.secondary-btn:hover {
  background: var(--primary-soft);
}

.secondary-btn.danger {
  color: #C0392B;
  border-color: #E6B0AA;
}

.secondary-btn.danger:hover {
  background: #FDEDEC;
}

.response-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  line-height: 1.7;
  font-size: 1rem;
  color: var(--text);
  white-space: pre-wrap;
}

.response-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-light);
}

/* --- CHAT --- */
#view-chat {
  padding: 0 40px;
  height: 100vh;
  display: none;
}

#view-chat.active {
  display: block;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 760px;
  margin: 0 auto;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  scroll-behavior: smooth;
  min-height: 0;
}

.chat-welcome {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.chat-welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
}

.chat-welcome-icon svg {
  width: 100%;
  height: 100%;
}

.chat-welcome h3 {
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 8px;
}

.chat-welcome p {
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

.message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: messageIn 0.3s ease;
  align-items: flex-start;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.message.assistant .message-avatar {
  background: var(--primary-soft);
  color: var(--primary);
}

.message.user .message-avatar {
  background: var(--secondary-light);
  color: var(--secondary);
}

.message-bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: var(--radius);
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  box-shadow: var(--shadow);
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-top-right-radius: 4px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-area {
  padding: 12px 0 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.chat-suggestions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.chat-suggestions button {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.chat-suggestions button:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--bg-warm);
}

.chat-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-card);
  resize: none;
  max-height: 120px;
  transition: border-color var(--transition);
  line-height: 1.5;
}

.chat-form textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(212, 131, 107, 0.3);
  flex-shrink: 0;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(212, 131, 107, 0.4);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

/* --- JOURNEY --- */
.journey-insights {
  margin-bottom: 28px;
}

.insight-card {
  background: linear-gradient(135deg, var(--primary-soft), var(--secondary-light));
  border-radius: var(--radius);
  padding: 24px 28px;
  line-height: 1.7;
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.journey-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.journey-timeline h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.timeline-entry:hover {
  transform: translateX(4px);
}

.timeline-emoji {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.timeline-info {
  flex: 1;
}

.timeline-emotion {
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-sub {
  color: var(--text-light);
  font-size: 0.85rem;
}

.timeline-trigger {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.timeline-meta {
  text-align: right;
  flex-shrink: 0;
}

.timeline-intensity {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-style: italic;
}

.journey-actions {
  margin-top: 28px;
  text-align: center;
}

/* --- TOOLKIT --- */
.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.toolkit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.toolkit-card:hover {
  box-shadow: var(--shadow-lg);
}

.toolkit-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.toolkit-icon svg {
  width: 24px;
  height: 24px;
}

.toolkit-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.toolkit-card p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 14px;
}

.toolkit-btn {
  padding: 10px 20px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}

.toolkit-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
}

.toolkit-btn.stop {
  color: #C0392B;
  border-color: #E6B0AA;
  margin-top: 12px;
}

/* Breathing */
.breathing-container {
  text-align: center;
  margin-top: 20px;
}

.breathing-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(135deg, #89CFF0, #6CB4EE);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  transition: transform 4s ease-in-out;
}

.breathing-circle.inhale {
  transform: scale(1.3);
}

.breathing-circle.exhale {
  transform: scale(0.8);
  transition-duration: 8s;
}

.breathing-circle.hold {
  transform: scale(1.3);
  transition-duration: 7s;
}

.breathing-timer {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Grounding */
.grounding-container {
  margin-top: 16px;
}

.grounding-step {
  text-align: center;
}

.grounding-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--emotion-peaceful);
  margin-bottom: 8px;
}

.grounding-prompt {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.grounding-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: 12px;
  resize: none;
}

.grounding-input:focus {
  outline: none;
  border-color: var(--emotion-peaceful);
}

/* Journaling */
.journal-container {
  margin-top: 16px;
}

.journal-prompt {
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 12px;
  font-style: italic;
  color: var(--text);
  line-height: 1.6;
  border-left: 3px solid var(--accent-warm);
}

.journal-textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  resize: vertical;
  margin-bottom: 12px;
  line-height: 1.6;
}

.journal-textarea:focus {
  outline: none;
  border-color: var(--accent-warm);
}

.journal-actions {
  display: flex;
  gap: 8px;
}

/* Reframing */
.reframing-container {
  margin-top: 16px;
}

.reframing-container label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 12px;
  color: var(--text);
}

.reframing-container textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  resize: none;
  margin-bottom: 4px;
}

.reframing-container textarea:focus {
  outline: none;
  border-color: var(--secondary);
}

.reframing-result {
  margin-top: 16px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 20px;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Compassion */
.compassion-container { margin-top: 16px; }

.compassion-step {
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 12px;
  line-height: 1.7;
  animation: fadeIn 0.5s ease;
}

.compassion-step h4 {
  color: var(--primary);
  margin-bottom: 8px;
}

/* Quick Relief */
.quick-relief-container { margin-top: 16px; }

.relief-item {
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  border-left: 3px solid var(--accent-warm);
}

.relief-item h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text);
}

.relief-item p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 0;
}

/* --- LOADER --- */
.gentle-loader {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- REMINDER BANNER --- */
.reminder-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #FFF3E0, #FFE8CC);
  border: 1px solid #F4A261;
  border-radius: var(--radius);
  margin-bottom: 24px;
  animation: fadeIn 0.5s ease;
}

.reminder-icon { font-size: 1.3rem; flex-shrink: 0; }

.reminder-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}

.reminder-btn {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.reminder-btn:hover { transform: scale(1.05); }

.reminder-dismiss {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* --- MILESTONES --- */
.milestones-section {
  margin-bottom: 32px;
  text-align: center;
}

.milestones-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.milestones-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ms-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  box-shadow: var(--shadow);
  min-width: 80px;
}

.ms-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.ms-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.milestones-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.ms-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, var(--primary-soft), var(--secondary-light));
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-width: 72px;
  cursor: default;
  transition: transform var(--transition);
}

.ms-badge:hover { transform: translateY(-2px); }

.ms-badge-icon { font-size: 1.4rem; }

.ms-badge-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 3px;
  text-align: center;
}

.ms-no-badges {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* --- SLEEP/ENERGY --- */
.sleep-energy-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  margin-top: 8px;
}

.se-field {
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.se-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.se-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.se-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.se-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: linear-gradient(to right, var(--emotion-sad), var(--emotion-happy));
  border-radius: 3px;
  outline: none;
}

.se-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--primary);
  cursor: pointer;
}

.se-value {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 4px;
}

.se-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
  cursor: pointer;
  margin-top: 6px;
}

.se-toggle input { cursor: pointer; }

/* --- MOOD CHART --- */
.mood-chart-section {
  margin-bottom: 28px;
}

.mood-chart-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding: 0 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px 24px;
  position: relative;
}

.chart-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
  cursor: default;
}

.chart-bar {
  width: 100%;
  max-width: 24px;
  min-height: 4px;
  border-radius: 3px 3px 0 0;
  transition: height 0.5s ease;
}

.chart-bar-label {
  font-size: 0.55rem;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.chart-extras {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  justify-content: center;
}

.chart-extra-stat {
  font-size: 0.8rem;
  color: var(--text-light);
}

.chart-extra-stat strong {
  color: var(--primary);
}

/* --- GRATITUDE --- */
.gratitude-container { margin-top: 16px; }

.gratitude-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.gratitude-input {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color var(--transition);
}

.gratitude-input:focus {
  outline: none;
  border-color: #F9C74F;
}

.gratitude-history { margin-top: 16px; }

.grat-entry {
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.grat-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.grat-item {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

/* --- MEDITATION --- */
.meditation-container {
  margin-top: 16px;
  text-align: center;
}

.med-timer-display {
  font-size: 3rem;
  font-weight: 300;
  color: var(--primary);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

.med-duration-select {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.med-dur-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-light);
  cursor: pointer;
  transition: all var(--transition);
}

.med-dur-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.med-sound-select {
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-light);
}

.med-sound-select select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  margin-left: 8px;
}

.med-instruction {
  font-size: 0.95rem;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 16px;
  line-height: 1.6;
  min-height: 2.5em;
  transition: opacity 0.3s ease;
}

/* --- RESOURCES --- */
.resources-section {
  margin-bottom: 36px;
}

.resources-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.resources-intro {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 18px;
}

.resource-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.resource-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.resource-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.resource-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.resource-card p {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  margin-bottom: 10px;
}

.resource-link {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid var(--primary-light);
  transition: all var(--transition);
}

.resource-link:hover {
  color: var(--text);
  border-color: var(--text);
}

/* --- EMOTION EDUCATION --- */
.emotion-education {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
}

.edu-card:hover {
  box-shadow: var(--shadow);
}

.edu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.edu-emoji { font-size: 1.3rem; }

.edu-header h4 {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.edu-toggle {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 300;
  transition: transform var(--transition);
}

.edu-card.expanded .edu-toggle {
  transform: rotate(45deg);
}

.edu-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  transition: all 0.4s ease;
}

.edu-card.expanded .edu-body {
  max-height: 500px;
  padding: 0 18px 18px;
}

.edu-body p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 8px;
}

.edu-body strong {
  color: var(--text);
}

/* --- EMERGENCY CONTACTS --- */
.emergency-contacts {
  max-width: 600px;
}

.ec-entry {
  display: grid;
  grid-template-columns: 2fr 2fr 1.5fr;
  gap: 8px;
  margin-bottom: 10px;
}

.ec-input {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color var(--transition);
}

.ec-input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.ec-status {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 20px;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- CHECK-IN RECORD SECTION --- */
.record-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.record-section .step-label {
  margin-bottom: 16px;
}

.record-date-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.record-date-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.record-date-input {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  transition: border-color var(--transition);
  max-width: 200px;
}

.record-date-input:focus {
  outline: none;
  border-color: var(--primary-light);
}

.record-field {
  margin-bottom: 14px;
}

.record-field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.record-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: white;
  resize: vertical;
  transition: border-color var(--transition);
}

.record-field textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.record-field textarea::placeholder {
  color: var(--text-muted);
}

/* --- JOURNEY RECORD CARDS --- */
.record-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.record-card:hover {
  border-color: var(--primary-soft);
  box-shadow: var(--shadow);
}

.record-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.record-emoji {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.record-header-info {
  flex: 1;
  min-width: 0;
}

.record-emotion {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.record-sub {
  font-weight: 400;
  color: var(--text-light);
  font-size: 0.85rem;
}

.record-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.record-intensity {
  background: var(--bg-warm);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 600;
  flex-shrink: 0;
}

.record-intensity span {
  color: var(--primary);
  font-size: 1rem;
}

.record-expand-icon {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.record-card.expanded .record-expand-icon {
  transform: rotate(180deg);
}

.record-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 16px;
}

.record-card.expanded .record-body {
  max-height: 600px;
  padding: 0 16px 16px;
}

.record-detail {
  margin-bottom: 10px;
}

.record-detail-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.record-detail p {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

.record-appreciate {
  background: linear-gradient(135deg, rgba(249, 199, 79, 0.08), rgba(243, 114, 44, 0.06));
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.record-appreciate .record-detail-label {
  color: var(--accent-warm);
}

.record-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-light);
  margin-right: 6px;
  margin-top: 6px;
}

/* --- HOME DISCLAIMER --- */
.home-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  padding: 14px 18px;
  background: rgba(180, 120, 80, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.home-disclaimer svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

.home-disclaimer p {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.6;
}

.home-disclaimer a {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

/* --- SIDEBAR LEGAL LINK --- */
.sidebar-legal {
  padding: 4px 12px 8px;
  text-align: center;
}

.sidebar-legal a {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.sidebar-legal a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* --- LEGAL MODAL --- */
.legal-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(74, 55, 40, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: authFadeIn 0.3s ease;
}

.legal-modal {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 36px 32px;
  width: 95%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(180, 120, 80, 0.2);
  animation: authSlideUp 0.35s ease;
}

.legal-modal h2 {
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 4px;
}

.legal-updated {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.legal-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.legal-modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.legal-section {
  margin-bottom: 20px;
}

.legal-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.legal-section p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 8px;
}

.legal-section ul {
  list-style: none;
  padding: 0;
}

.legal-section li {
  position: relative;
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 6px;
}

.legal-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--primary-soft);
  border-radius: 50%;
}

.legal-section a {
  color: var(--primary);
  text-decoration: underline;
}

.legal-footer {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}

@media (max-width: 480px) {
  .legal-modal {
    margin: 8px;
    padding: 24px 18px;
    max-height: 90vh;
  }
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .quick-actions {
    grid-template-columns: 1fr;
  }

  .toolkit-grid {
    grid-template-columns: 1fr;
  }

  .journey-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .emotion-grid,
  .sub-emotion-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .resource-cards {
    grid-template-columns: 1fr;
  }

  .sleep-energy-row {
    grid-template-columns: 1fr;
  }

  .ec-entry {
    grid-template-columns: 1fr;
  }

  .reminder-banner {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding-bottom: 64px;
  }

  .view {
    padding: 20px 16px;
  }

  #view-chat {
    padding: 0 12px;
    height: calc(100vh - 60px);
  }

  .chat-container {
    height: calc(100vh - 60px);
  }

  .home-hero h1 {
    font-size: 1.6rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .action-card h3 {
    font-size: 1rem;
  }

  .action-card p {
    font-size: 0.82rem;
  }

  .message-bubble {
    max-width: 88%;
  }

  /* --- BOTTOM TAB BAR --- */
  .mobile-tabs {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(180, 120, 80, 0.08);
    padding: 4px 0;
    padding-bottom: env(safe-area-inset-bottom, 4px);
  }

  .tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
  }

  .tab-btn svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
  }

  .tab-btn.active {
    color: var(--primary);
    font-weight: 700;
  }

  .tab-btn.active svg {
    transform: scale(1.1);
  }

  .tab-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2.5px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
  }

  /* --- MORE MENU POPUP --- */
  .mobile-more-menu {
    position: fixed;
    bottom: 60px;
    right: 8px;
    z-index: 210;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 -4px 24px rgba(180, 120, 80, 0.18), 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border);
    flex-direction: column;
    padding: 6px;
    min-width: 170px;
    animation: moreMenuIn 0.2s ease;
  }

  @keyframes moreMenuIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--text-light);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
  }

  .more-menu-item:hover, .more-menu-item.active {
    background: var(--primary-soft);
    color: var(--primary);
  }

  .more-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
}
