/* ===== CSS Variables & Reset ===== */
:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;

  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;

  --green-400: #a3e635;
  --green-500: #84cc16;

  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --bg: #ffffff;
  --bg-secondary: var(--gray-50);
  --bg-card: #ffffff;
  --text: var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-muted: var(--gray-400);
  --border: var(--gray-200);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0a1628;
  --bg-secondary: #111d33;
  --bg-card: #152238;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e3a5f;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.2);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== App Shell ===== */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

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

.menu-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

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

.menu-btn svg {
  width: 24px;
  height: 24px;
}

.header-logo {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-share-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
}

.header-share-btn:hover {
  color: var(--blue-500);
  background: var(--bg-secondary);
}

.header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-400), var(--purple-400));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ===== Slide-out Menu ===== */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.slide-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.menu-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.menu-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px var(--blue-200);
}

[data-theme="dark"] .menu-avatar {
  box-shadow: 0 0 0 3px var(--blue-700);
}

.menu-user-info h3 {
  font-size: 1rem;
  font-weight: 600;
}

.menu-user-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.menu-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.menu-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 22px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background var(--transition);
  cursor: pointer;
}

.menu-nav a:hover,
.menu-nav a.active {
  background: var(--bg-secondary);
}

.menu-nav a.active {
  color: var(--blue-500);
}

.menu-nav a svg {
  width: 22px;
  height: 22px;
  opacity: 0.7;
}

.menu-nav a.active svg {
  opacity: 1;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 20px;
}

.menu-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===== Pages ===== */
.page {
  display: none;
  padding: 0 20px 100px;
  animation: fadeIn 0.25s ease;
}

.page.active {
  display: block;
}

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

/* ===== Home Page ===== */
.hero {
  text-align: center;
  padding: 32px 0 24px;
}

.hero-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 4px;
  position: relative;
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.3));
}

.speech-bubble {
  position: absolute;
  top: -4px;
  right: -65px;
  background: var(--green-400);
  color: #1a2e05;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 12px 12px 12px 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  color: var(--blue-500);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

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

/* Add to Homescreen Banner */
.pwa-banner {
  background: linear-gradient(135deg, var(--blue-500), var(--purple-600));
  color: white;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.pwa-banner:hover {
  transform: scale(1.01);
}

.pwa-banner svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

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

.pwa-banner-text strong {
  display: block;
  font-size: 0.9rem;
}

.pwa-banner-text span {
  font-size: 0.78rem;
  opacity: 0.85;
}

.pwa-banner-close {
  background: none;
  border: none;
  color: white;
  opacity: 0.7;
  cursor: pointer;
  padding: 4px;
  font-size: 1.2rem;
  line-height: 1;
}

.pwa-banner-close:hover {
  opacity: 1;
}

/* Greeting Flow */
.greeting-flow {
  margin-bottom: 24px;
}

.greeting-flow h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.greeting-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

/* Setup Prompt */
.setup-prompt {
  margin-bottom: 16px;
}

.setup-prompt-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px dashed var(--blue-400);
  border-radius: var(--radius-sm);
  color: var(--blue-500);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.setup-prompt-link:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(139, 92, 246, 0.14));
  transform: translateY(-1px);
}

.setup-prompt-link svg {
  flex-shrink: 0;
  opacity: 0.8;
}

/* Search / Input Area */
.search-area {
  position: relative;
  margin-bottom: 28px;
}

.search-input {
  width: 100%;
  padding: 16px 52px 16px 20px;
  border: 2px solid var(--border);
  border-radius: 28px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.search-btn:hover {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.search-btn svg {
  width: 20px;
  height: 20px;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  text-align: center;
}

.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-400);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 1.4rem;
}

.action-icon.search { background: rgba(59, 130, 246, 0.12); }
.action-icon.write { background: rgba(139, 92, 246, 0.12); }
.action-icon.calendar { background: rgba(236, 72, 153, 0.12); }
.action-icon.travel { background: rgba(16, 185, 129, 0.12); }
.action-icon.research { background: rgba(245, 158, 11, 0.12); }
.action-icon.homework { background: rgba(99, 102, 241, 0.12); }
.action-icon.games { background: rgba(239, 68, 68, 0.12); }
.action-icon.private { background: rgba(20, 184, 166, 0.12); }

.action-card h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.action-card p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Share Card */
.share-card {
  background: linear-gradient(135deg, #eef2ff, #f0e6ff);
  border: 1px solid var(--blue-200);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

[data-theme="dark"] .share-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
  border-color: var(--border);
}

.share-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.share-card-content {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.share-qbit-wrapper {
  position: relative;
  flex-shrink: 0;
}

.share-card-avatar {
  width: 80px;
  height: 80px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.25));
}

.share-speech-bubble {
  position: absolute;
  top: -8px;
  left: 58px;
  background: var(--green-400);
  color: #1a2e05;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 12px 12px 12px 2px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.share-card-text h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.share-card-text p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.share-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 0;
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  color: white;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: opacity var(--transition);
}

.share-card:hover .share-card-btn {
  opacity: 0.9;
}

/* Menu Share Link */
.menu-share-link {
  color: var(--blue-500) !important;
}

/* ===== About Page ===== */
.about-hero {
  text-align: center;
  padding: 32px 0 24px;
}

.about-hero img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.3));
}

.about-hero h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.about-hero .subtitle {
  color: var(--blue-500);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.about-description {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.about-description p + p {
  margin-top: 12px;
}

.faq-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
  padding-left: 4px;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}

.faq-item:hover {
  border-color: var(--blue-400);
}

.faq-question {
  padding: 16px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

.faq-question::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.faq-item.open .faq-question::after {
  transform: rotate(-135deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-answer-inner {
  padding: 0 18px 16px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.faq-item.open .faq-answer {
  max-height: 200px;
}

/* ===== Settings Page ===== */
.settings-header {
  padding: 28px 0 20px;
}

.settings-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.settings-header p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 4px;
}

.settings-group {
  margin-bottom: 24px;
}

.settings-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 4px 10px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.setting-item {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

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

.setting-info {
  flex: 1;
  min-width: 0;
}

.setting-label {
  font-size: 0.92rem;
  font-weight: 500;
}

.setting-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.setting-input {
  width: 100%;
  max-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.setting-input:focus {
  border-color: var(--blue-400);
}

.setting-item-full {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.setting-input-full {
  max-width: none !important;
  width: 100%;
}

.location-inputs {
  display: flex;
  gap: 8px;
  width: 100%;
}

.location-input {
  max-width: none !important;
  min-width: 0;
  flex: 1;
  padding: 8px 10px !important;
  font-size: 0.85rem !important;
}

.setting-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
  transition: border-color var(--transition);
}

.setting-textarea::placeholder {
  color: var(--text-muted);
}

.setting-textarea:focus {
  border-color: var(--blue-400);
}

/* Radio Buttons */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  padding: 4px 0;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-mark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s;
}

[data-theme="dark"] .radio-mark {
  border-color: var(--gray-600);
}

.radio-option input:checked ~ .radio-mark {
  border-color: var(--blue-500);
}

.radio-option input:checked ~ .radio-mark::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue-500);
}

.radio-text {
  color: var(--text-secondary);
  line-height: 1.4;
}

.setting-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.2s;
}

[data-theme="dark"] .toggle-slider {
  background: var(--gray-600);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--blue-500);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Important Dates */
.dates-hint {
  padding: 12px 18px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: italic;
  border-bottom: 1px solid var(--border);
}

.date-entry-birthday {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe, #e8e0ff);
  border: 2px solid #a78bfa;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  border-bottom: 2px solid #a78bfa;
}

[data-theme="dark"] .date-entry-birthday {
  background: linear-gradient(135deg, #2d1f3d, #1f2a4a, #2d1f3d);
  border-color: #a855f7;
}

.birthday-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.birthday-icon-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
  flex-shrink: 0;
}

.birthday-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.birthday-label {
  font-size: 1rem;
  font-weight: 700;
  color: #7c3aed;
  letter-spacing: 0.01em;
}

[data-theme="dark"] .birthday-label {
  color: #c4b5fd;
}

.birthday-sub {
  font-size: 0.78rem;
  color: #6d28d9;
  opacity: 0.7;
}

[data-theme="dark"] .birthday-sub {
  color: #c4b5fd;
  opacity: 0.6;
}

.birthday-date-input {
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid #a78bfa;
  background: rgba(255,255,255,0.7);
  color: var(--text);
  cursor: pointer;
}

[data-theme="dark"] .birthday-date-input {
  border-color: #a855f7;
  background: rgba(255,255,255,0.08);
}

.birthday-trigger {
  border: 1.5px solid #a78bfa !important;
  background: rgba(255,255,255,0.7) !important;
  min-width: 120px !important;
  max-width: 150px !important;
}

[data-theme="dark"] .birthday-trigger {
  border-color: #a855f7 !important;
  background: rgba(255,255,255,0.08) !important;
}

.dates-section {
  margin-top: 0;
}

.date-entry {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}

.date-entry:last-child {
  border-bottom: none;
}

.date-entry input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.date-entry input:focus {
  border-color: var(--blue-400);
}

.date-entry input[type="date"] {
  max-width: 160px;
  flex-shrink: 0;
  cursor: pointer;
}

/* Date trigger button — replaces invisible date input when empty */
.date-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 130px;
  max-width: 160px;
  white-space: nowrap;
  transition: border-color var(--transition);
}

.date-trigger:hover,
.date-trigger:focus {
  border-color: var(--blue-400);
}

.date-trigger svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  flex-shrink: 0;
}

.date-trigger-value {
  color: var(--text);
}

.add-date-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  color: var(--blue-500);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: inherit;
  transition: background var(--transition);
}

.add-date-btn:hover {
  background: var(--bg-secondary);
}

.remove-date-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
}

.remove-date-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ===== Terms & Privacy Pages ===== */
.legal-page {
  padding-top: 32px;
}

.legal-page h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.legal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
}

.legal-content h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 20px 0 8px;
  color: var(--text);
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

.legal-content ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-content li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 4px;
}

.legal-updated {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-style: italic;
}

/* ===== Share Modal ===== */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.share-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.share-modal {
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 480px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.share-modal-overlay.open .share-modal {
  transform: translateY(0);
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.share-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.share-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
}

.share-modal-close:hover {
  background: var(--bg-secondary);
}

.share-modal-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  font-family: inherit;
}

.share-option:hover {
  background: var(--bg-secondary);
  transform: translateY(-2px);
}

.share-option-icon {
  font-size: 1.6rem;
  line-height: 1;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--gray-700);
}

/* ===== Safe Area (notch devices) ===== */
@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .page {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }
}
