/* ============================================================
   Gift Gleaner – Mobile App CSS
   Primary: #FF6F61  Secondary: #4A90E2  Accent: #F5A623
   ============================================================ */

:root {
  --primary: #FF6F61;
  --primary-light: #FFE4E1;
  --primary-dark: #E5574A;
  --secondary: #4A90E2;
  --secondary-light: #E3EEFF;
  --accent: #F5A623;
  --accent-light: #FFF3D6;

  --bg: #F7F8FC;
  --surface: #FFFFFF;
  --surface-2: #F0F1F6;
  --border: #E8E9EF;
  --divider: #F0F1F5;

  --text-primary: #1A1D2E;
  --text-secondary: #6B7080;
  --text-hint: #B0B5C4;
  --text-on-primary: #FFFFFF;

  --nav-height: 64px;
  --appbar-height: 56px;
  --search-height: 56px;
  --drawer-width: 280px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --shadow-fab: 0 6px 20px rgba(255,111,97,0.40);

  --transition: 0.22s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.36s cubic-bezier(0.4,0,0.2,1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, textarea { font-family: var(--font); }
a { text-decoration: none; color: inherit; cursor: pointer; }

/* ── App Bar ── */
.app-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--appbar-height);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 8px 0 4px;
  gap: 4px;
  z-index: 150;
  box-shadow: 0 1px 0 var(--border);
}

.app-bar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* ── Search Bar ── */
.search-bar-container {
  position: fixed;
  top: var(--appbar-height);
  left: 0; right: 0;
  height: 0;
  overflow: hidden;
  background: var(--surface);
  z-index: 99;
  transition: height var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.search-bar-container.open {
  height: var(--search-height);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 16px;
  padding: 0 14px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  height: 40px;
  color: var(--text-secondary);
}

.search-bar input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
}

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

/* ── Drawer Overlay ── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Side Drawer ── */
.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--drawer-width);
  background: var(--surface);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  box-shadow: var(--shadow-lg);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-logo-icon { font-size: 26px; }

.drawer-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

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

.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  margin-right: 12px;
}

.drawer-item:hover, .drawer-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.drawer-item svg { flex-shrink: 0; }

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.drawer-version {
  font-size: 12px;
  color: var(--text-hint);
}

/* ── Main Content ── */
.main-content {
  position: fixed;
  top: var(--appbar-height);
  left: 0; right: 0;
  bottom: var(--nav-height);
  overflow: hidden;
  z-index: 1;
}

.main-content.search-open {
  top: calc(var(--appbar-height) + var(--search-height));
}

/* ── Screens ── */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--transition), transform var(--transition);
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 0;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.screen-scroll::-webkit-scrollbar { display: none; }

.bottom-spacer { height: 24px; }

/* Drawer screens use full height */
.drawer-screen {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--surface);
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--border);
  z-index: 150;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-hint);
  transition: color var(--transition);
  position: relative;
  min-height: 44px;
}

.nav-item span {
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* ── Icon Buttons ── */
.icon-btn {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--border); }

.icon-btn-sm {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition);
  flex-shrink: 0;
}
.icon-btn-sm:hover { background: var(--surface-2); }
.icon-btn-sm:active { background: var(--border); }

.back-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background var(--transition);
}
.back-btn:hover { background: var(--surface-2); }

.ml-auto { margin-left: auto; }

/* ── FAB ── */
.fab {
  position: absolute;
  bottom: 24px; right: 20px;
  width: 56px; height: 56px;
  background: var(--primary);
  color: var(--text-on-primary);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-fab);
  z-index: 50;
  transition: transform var(--transition), box-shadow var(--transition);
}
.fab:active {
  transform: scale(0.93);
  box-shadow: 0 3px 10px rgba(255,111,97,0.3);
}

/* ── Buttons ── */
.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border-radius: var(--radius-full);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
  min-height: 48px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.97); }

.btn-outline {
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
  min-height: 48px;
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--text-hint); }
.btn-outline:active { background: var(--border); }

.btn-danger {
  background: #FF3B30;
  color: white;
  border-radius: var(--radius-full);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-danger:hover { background: #D62A20; }
.btn-danger:active { transform: scale(0.97); }

.text-btn {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.text-btn:hover { background: var(--primary-light); }

/* ── AI Buttons & Badges ── */
.ai-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.ai-badge-sm {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  flex-shrink: 0;
}

.ai-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ai-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
  border: 1px solid rgba(102,126,234,0.3);
  color: #5a67d8;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  transition: background var(--transition), transform var(--transition);
  min-height: 36px;
}
.ai-btn:hover { background: linear-gradient(135deg, rgba(102,126,234,0.18), rgba(118,75,162,0.18)); }
.ai-btn:active { transform: scale(0.96); }
.ai-btn-icon { font-size: 14px; }

.ai-btn-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
  border: 1px solid rgba(102,126,234,0.25);
  color: #5a67d8;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  transition: background var(--transition);
}
.ai-btn-sm:hover { background: linear-gradient(135deg, rgba(102,126,234,0.18), rgba(118,75,162,0.18)); }

/* ── AI Tip Card ── */
.ai-tip-card {
  background: linear-gradient(135deg, #667eea15, #764ba215);
  border: 1px solid rgba(102,126,234,0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.ai-tip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ai-tip-icon { font-size: 22px; }

.ai-tip-label {
  font-size: 13px;
  font-weight: 600;
  color: #5a67d8;
  margin-bottom: 2px;
}

.ai-tip-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--primary);
}

.stat-card.accent { border-left-color: var(--accent); }
.stat-card.secondary { border-left-color: var(--secondary); }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.card:active { transform: scale(0.985); box-shadow: none; }

.card-inner {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.card-tag.primary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.card-tag.accent {
  background: var(--accent-light);
  color: #B87333;
}

.card-tag.secondary {
  background: var(--secondary-light);
  color: #2962a3;
}

.card-chevron {
  color: var(--text-hint);
  flex-shrink: 0;
}

.card-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* ── Budget Card ── */
.budget-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.budget-empty {
  font-size: 13px;
  color: var(--text-hint);
  text-align: center;
  padding: 12px 0;
}

.budget-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.budget-row:last-child { margin-bottom: 0; }

.budget-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  width: 100px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.budget-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.budget-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

/* ── Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.7; }

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 240px;
  margin-bottom: 24px;
}

.empty-inline {
  font-size: 13px;
  color: var(--text-hint);
  text-align: center;
  padding: 16px;
}

/* ── Skeleton Loading ── */
.skeleton-text {
  height: 14px;
  background: linear-gradient(90deg, #e8e9ef 25%, #f0f1f6 50%, #e8e9ef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  width: 100%;
}
.skeleton-text.short { width: 60%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Filter Chips ── */
.filter-chips {
  display: flex;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  min-height: 36px;
}
.chip.active, .chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ── Group Headers ── */
.group-header {
  padding: 8px 4px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── Contact Card ── */
.contact-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  overflow: hidden;
}

.contact-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition);
}
.contact-header:hover { background: var(--surface-2); }

.contact-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.contact-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.contact-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.contact-ideas {
  border-top: 1px solid var(--divider);
  padding: 8px 16px;
}

.contact-idea-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  transition: opacity var(--transition);
  border-bottom: 1px solid var(--divider);
}
.contact-idea-item:last-child { border-bottom: none; }
.contact-idea-item:hover { opacity: 0.75; }

.contact-idea-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.contact-idea-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.contact-idea-occasion {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ── Bottom Sheet ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.center-overlay { align-items: center; }

.bottom-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 400;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.bottom-sheet::-webkit-scrollbar { display: none; }

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin: 12px auto 0;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}

.bottom-sheet-header h2 {
  font-size: 18px;
  font-weight: 700;
}

/* ── Form ── */
.form { padding: 8px 20px 20px; }

.form-field {
  position: relative;
  margin-bottom: 16px;
}

.form-input {
  width: 100%;
  height: 56px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 16px 0;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.form-input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.form-label {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-hint);
  pointer-events: none;
  transition: all var(--transition);
  transform-origin: left top;
}

.form-input:focus ~ .form-label,
.form-input:not(:placeholder-shown) ~ .form-label {
  transform: translateY(-140%) scale(0.8);
  color: var(--primary);
  font-weight: 600;
}

.form-error {
  font-size: 11px;
  color: #FF3B30;
  margin-top: 4px;
  display: block;
}

.form-field.has-error .form-input {
  border-color: #FF3B30;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.form-actions button { flex: 1; }

/* ── AI Suggestion Strip ── */
.ai-suggestion-strip {
  padding: 0 20px 12px;
}

.ai-suggestions-list {
  padding: 0 20px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-chip {
  padding: 7px 14px;
  background: var(--accent-light);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: #7B5700;
  cursor: pointer;
  transition: background var(--transition);
}
.suggestion-chip:hover { background: #FFE8A3; }

/* ── Detail Sheet ── */
.detail-sheet { max-height: 80vh; }

.detail-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--divider);
}

.detail-field-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  margin-top: 1px;
}

.detail-field-body {}

.detail-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.detail-field-value {
  font-size: 15px;
  color: var(--text-primary);
  word-break: break-word;
}

.detail-field-value a {
  color: var(--secondary);
  text-decoration: underline;
}

.ai-suggestion-row {
  padding: 12px 20px;
}

.ai-result-card {
  margin: 0 20px 12px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(102,126,234,0.05), rgba(118,75,162,0.05));
  border: 1px solid rgba(102,126,234,0.2);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

.detail-actions {
  display: flex;
  gap: 12px;
  padding: 12px 20px 20px;
}
.detail-actions button { flex: 1; }

/* ── AI Result Sheet ── */
.ai-sheet {}

.ai-sheet-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.ai-sheet-title h2 {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}

.ai-sheet-body {
  padding: 8px 20px 20px;
  min-height: 200px;
}

.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 14px;
}

.ai-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(102,126,234,0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.ai-result-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.ai-result-section {
  margin-bottom: 16px;
}

.ai-result-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #5a67d8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.ai-sheet-footer {
  padding: 0 20px 20px;
}

/* ── Confirm Dialog ── */
.confirm-dialog {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  width: calc(100% - 64px);
  max-width: 320px;
  z-index: 500;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
}

.confirm-dialog.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.confirm-icon { font-size: 40px; margin-bottom: 12px; }

.confirm-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.confirm-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}
.confirm-actions button { flex: 1; }

/* ── Snackbar ── */
.snackbar {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  left: 16px; right: 16px;
  background: #2d3142;
  color: white;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
  z-index: 600;
  transform: translateY(120%);
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
  box-shadow: var(--shadow-lg);
}

.snackbar.show {
  transform: translateY(0);
  opacity: 1;
}

.snackbar-action {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  margin-left: 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

/* ── Charts ── */
.chart-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.chart-container {
  width: 100%;
  min-height: 140px;
  position: relative;
}

.chart-container.horiz { min-height: 120px; }
.chart-container.donut { min-height: 160px; display: flex; align-items: center; justify-content: center; }

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  font-size: 13px;
  color: var(--text-hint);
}

.chart-svg { width: 100%; display: block; }

.chart-bar-label {
  font-size: 10px;
  fill: var(--text-secondary);
}

.chart-bar-value {
  font-size: 10px;
  fill: var(--text-primary);
  font-weight: 600;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Progress bars for chart */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.progress-row:last-child { margin-bottom: 0; }

.progress-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  width: 90px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.7s cubic-bezier(0.4,0,0.2,1);
}

.progress-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: right;
}

/* ── Chat UI ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}
.chat-messages::-webkit-scrollbar { display: none; }

.chat-bubble {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble.assistant {
  align-self: flex-start;
}

.bubble-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.bubble-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.chat-bubble.user .bubble-content {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
}

.chat-bubble.assistant .bubble-content {
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 4px;
}

.bubble-content p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.bubble-time {
  font-size: 10px;
  opacity: 0.5;
  display: block;
  margin-top: 4px;
}

.chat-bubble.user .bubble-time {
  text-align: right;
  color: rgba(255,255,255,0.8);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-hint);
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.chat-input-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 12px 10px;
  padding-bottom: env(safe-area-inset-bottom, 10px);
  flex-shrink: 0;
  overflow: visible;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-xl);
  padding: 6px 8px 6px 14px;
  border: 1.5px solid var(--border);
  transition: border-color var(--transition);
}
.chat-input-row:focus-within { border-color: var(--primary); }

.chat-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  resize: none;
  font-size: 14px;
  color: var(--text-primary);
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}

.chat-input::placeholder { color: var(--text-hint); }

.chat-send-btn {
  width: 36px; height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-send-btn:active { transform: scale(0.9); }
.chat-send-btn:disabled { background: var(--border); cursor: default; }

/* ── Ripple Effect ── */
.ripple-container { position: relative; overflow: hidden; }

/* ── Occasion Card ── */
.occasion-group {
  margin-bottom: 16px;
}

.occasion-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  padding: 6px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Utility ── */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mb-12 { margin-bottom: 12px; }

/* ── Responsive touches ── */
@media (max-width: 380px) {
  .stats-row { gap: 7px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
}
