/* ===== CSS VARIABLES ===== */
:root {
  --primary: #FF6F61;
  --primary-dark: #e55a4d;
  --primary-light: rgba(255,111,97,0.12);
  --secondary: #4CAF50;
  --secondary-light: rgba(76,175,80,0.12);
  --accent: #FFCA28;
  --accent-light: rgba(255,202,40,0.12);

  --bg: #F7F5F3;
  --surface: #FFFFFF;
  --surface-2: #F2F0EE;
  --border: rgba(0,0,0,0.08);
  --divider: rgba(0,0,0,0.06);

  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-hint: #ABABAB;

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

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

  --app-bar-height: 56px;
  --bottom-nav-height: 64px;
  --drawer-width: 280px;

  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.35s cubic-bezier(0.4,0,0.2,1);

  --status-planned: #9C27B0;
  --status-inprogress: #FF6F61;
  --status-completed: #4CAF50;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: none;
}

button { cursor: pointer; }
a { text-decoration: none; color: inherit; }

/* ===== TOP APP BAR ===== */
.app-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--app-bar-height);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 8px;
  z-index: 100;
  border-bottom: 1px solid var(--divider);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

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

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

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.icon-btn:active { background: rgba(0,0,0,0.08); }

/* ===== SEARCH BAR ===== */
.search-bar-container {
  position: fixed;
  top: var(--app-bar-height);
  left: 0; right: 0;
  z-index: 99;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-xl);
  padding: 8px 14px;
  color: var(--text-secondary);
}
.search-bar input {
  flex: 1;
  background: none;
  font-size: 15px;
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-hint); }
.search-bar button { color: var(--text-secondary); display: flex; align-items: center; }

/* ===== DRAWER ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 199;
  pointer-events: none;
  transition: background var(--transition-slow);
}
.drawer-overlay.active {
  background: rgba(0,0,0,0.45);
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--drawer-width);
  background: var(--surface);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 52px 20px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, #FF9A5C 100%);
}
.drawer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.drawer-logo-icon {
  font-size: 36px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.drawer-app-name {
  font-size: 18px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.3px;
}
.drawer-tagline {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
}

.drawer-divider {
  height: 1px;
  background: var(--divider);
  margin: 8px 0;
}

.drawer-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-hint);
  padding: 8px 20px 4px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  width: 100%;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background var(--transition);
  position: relative;
}
.drawer-item:hover { background: var(--surface-2); }
.drawer-item:active { background: var(--primary-light); color: var(--primary); }
.drawer-item.active {
  background: var(--primary-light);
  color: var(--primary);
}
.drawer-item-icon { color: var(--text-secondary); display: flex; }
.drawer-item:active .drawer-item-icon,
.drawer-item.active .drawer-item-icon { color: var(--primary); }

.drawer-badge {
  margin-left: auto;
  background: linear-gradient(135deg, var(--primary), #FF9A5C);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  position: fixed;
  top: var(--app-bar-height);
  left: 0; right: 0;
  bottom: var(--bottom-nav-height);
  overflow: hidden;
}
.main-content.search-open {
  top: calc(var(--app-bar-height) + 56px);
}

/* ===== SCREENS ===== */
.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(20px);
  transition: opacity var(--transition), transform var(--transition);
  overflow: hidden;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}
.screen-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  scrollbar-width: none;
}
.screen-scroll::-webkit-scrollbar { display: none; }

.drawer-screen {
  transform: translateX(30px);
}
.drawer-screen.active {
  transform: translateX(0);
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-height);
  background: var(--surface);
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--divider);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-hint);
  transition: color var(--transition);
  padding: 8px 4px 4px;
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
  transition: width var(--transition);
}
.nav-item.active {
  color: var(--primary);
}
.nav-item.active::before { width: 32px; }
.nav-icon { transition: transform var(--transition); }
.nav-item.active .nav-icon { transform: scale(1.1); }
.nav-item:active { background: var(--primary-light); }

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(255, 111, 97, 0.45);
  z-index: 98;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(255, 111, 97, 0.5);
}
.fab:active {
  transform: scale(0.95);
}
.fab .material-icons-round {
  font-size: 26px;
  font-weight: 500;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== SECTION HEADERS ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 10px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.text-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.text-btn:active { background: var(--primary-light); }

/* ===== AI TIP CARD ===== */
.ai-tip-card {
  background: linear-gradient(135deg, #fff9f8 0%, #fff5f3 100%);
  border: 1.5px solid rgba(255,111,97,0.2);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 4px;
  min-height: 90px;
  box-shadow: var(--shadow-sm);
}
.ai-tip-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ai-tip-emoji { font-size: 20px; }
.ai-tip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.3px;
}
.ai-tip-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.ai-retry-btn {
  font-size: 12px;
  color: var(--primary);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1.5px solid rgba(255,111,97,0.3);
  background: white;
  transition: all var(--transition);
}
.ai-retry-btn:active { background: var(--primary-light); }

/* ===== SHIMMER SKELETON ===== */
@keyframes shimmer {
  0% { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}
.shimmer-line {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, #f0ede9 25%, #e8e4e0 50%, #f0ede9 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}

/* ===== AI BADGES ===== */
.ai-badge {
  background: linear-gradient(135deg, var(--primary) 0%, #FF9A5C 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  letter-spacing: 0.3px;
}
.ai-badge-sm {
  background: linear-gradient(135deg, var(--primary) 0%, #FF9A5C 100%);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* ===== AI ACTION BUTTONS ===== */
.ai-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  border: 1.5px solid rgba(255,111,97,0.15);
  transition: all var(--transition);
}
.ai-action-btn:active {
  background: var(--primary-light);
  border-color: rgba(255,111,97,0.3);
  transform: scale(0.98);
}
.ai-btn-icon { font-size: 18px; }

.ai-action-btn-sm {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  border: 1.5px solid rgba(255,111,97,0.2);
  transition: all var(--transition);
}
.ai-action-btn-sm:active { background: rgba(255,111,97,0.2); }

.ai-suggestion-result {
  background: linear-gradient(135deg, #fff9f8, #fff5f3);
  border: 1.5px solid rgba(255,111,97,0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ===== QUICK ACTIONS ===== */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 12px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.quick-action-btn:active {
  background: var(--primary-light);
  color: var(--primary);
  transform: scale(0.96);
}
.qa-icon { font-size: 24px; }

/* ===== FILTER CHIPS ===== */
.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 0 12px;
  -webkit-overflow-scrolling: touch;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1.5px solid var(--border);
  transition: all var(--transition);
}
.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.chip:active { transform: scale(0.95); }

/* ===== PROJECT CARDS ===== */
.project-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.project-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.project-card[data-status="planned"]::before { background: var(--status-planned); }
.project-card[data-status="in progress"]::before { background: var(--status-inprogress); }
.project-card[data-status="completed"]::before { background: var(--status-completed); }
.project-card:active { transform: scale(0.98); box-shadow: var(--shadow-sm); }

.project-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.project-card-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.2px;
}
.status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.2px;
}
.status-badge.planned {
  background: rgba(156,39,176,0.1);
  color: var(--status-planned);
}
.status-badge.in-progress {
  background: rgba(255,111,97,0.1);
  color: var(--status-inprogress);
}
.status-badge.completed {
  background: rgba(76,175,80,0.1);
  color: var(--status-completed);
}

.project-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-card-date {
  font-size: 11px;
  color: var(--text-hint);
  display: flex;
  align-items: center;
  gap: 4px;
}
.project-card-actions {
  display: flex;
  gap: 4px;
}
.card-action-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.card-action-btn:active { transform: scale(0.9); }
.card-action-btn.edit:active { background: var(--primary-light); color: var(--primary); }
.card-action-btn.delete:active { background: rgba(244,67,54,0.1); color: #F44336; }

/* ===== IDEA CARDS ===== */
.idea-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.idea-card:active { transform: scale(0.98); }
.idea-card-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--accent-light);
}
.idea-card-body { flex: 1; min-width: 0; }
.idea-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}
.idea-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.idea-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.idea-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 500;
}
.idea-card-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

/* ===== MATERIAL CARDS ===== */
.material-category {
  margin-bottom: 16px;
}
.material-category-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0 10px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--divider);
}
.material-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.material-item-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  transition: all var(--transition);
}
.material-item-card:active { transform: scale(0.98); }
.material-item-header {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.material-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.material-item-qty {
  font-size: 12px;
  color: var(--text-hint);
  flex-shrink: 0;
}
.material-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.material-item-actions {
  display: flex;
  gap: 4px;
}

/* Material selection UI */
.project-materials-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
}
.selected-material-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  border: 1.5px solid rgba(255,111,97,0.3);
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
}
.remove-chip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 2px;
  color: var(--primary);
  opacity: 0.7;
  transition: opacity var(--transition);
}
.remove-chip-btn:hover { opacity: 1; }

.material-select-group {
  margin-bottom: 16px;
}
.material-select-category {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0 10px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--divider);
}
.material-select-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.material-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.material-select-item:active { background: rgba(0,0,0,0.06); }
.material-select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.material-select-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.material-select-qty {
  font-size: 11px;
  color: var(--text-hint);
  flex-shrink: 0;
}

.ai-suggest-materials-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
}
.ai-suggest-materials-btn:active { background: rgba(255,111,97,0.2); }

/* ===== EMPTY STATES ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 4px;
  opacity: 0.7;
}
.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.empty-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 240px;
}
.btn-primary-sm {
  margin-top: 4px;
  padding: 10px 24px;
  background: var(--primary);
  color: white;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(255,111,97,0.35);
  transition: all var(--transition);
}
.btn-primary-sm:active { transform: scale(0.96); }

/* ===== CHARTS ===== */
.chart-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.chart-donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-label { font-weight: 500; }
.legend-value {
  margin-left: auto;
  font-weight: 600;
  color: var(--text-primary);
}

/* Progress bars */
.progress-item {
  margin-bottom: 14px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.progress-label span:first-child { font-weight: 600; color: var(--text-primary); }
.progress-label span:last-child { color: var(--text-secondary); }
.progress-bar-bg {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* Timeline */
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--divider);
}
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: var(--surface-2);
  z-index: 1;
}
.timeline-content { flex: 1; }
.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.timeline-date {
  font-size: 12px;
  color: var(--text-hint);
}

/* ===== BOTTOM SHEETS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 299;
  pointer-events: none;
  transition: background var(--transition-slow);
}
.modal-overlay.active {
  background: rgba(0,0,0,0.5);
  pointer-events: all;
}

.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: 300;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-tall { max-height: 92vh; }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--divider);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--divider);
}
.sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
}

.sheet-content {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
}
.sheet-content::-webkit-scrollbar { display: none; }

.sheet-actions {
  display: flex;
  gap: 12px;
  padding: 8px 0 4px;
  margin-top: 8px;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
  position: relative;
  margin-bottom: 20px;
}
.form-row {
  display: flex;
  gap: 12px;
}
.form-input {
  width: 100%;
  padding: 16px 14px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,111,97,0.12);
}
.form-textarea {
  resize: none;
  min-height: 80px;
}
.form-select {
  cursor: pointer;
  padding-top: 18px;
  padding-bottom: 8px;
}
.form-label {
  position: absolute;
  left: 14px;
  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 {
  top: 8px;
  transform: translateY(0) scale(0.75);
  color: var(--primary);
  font-weight: 600;
}
.form-textarea ~ .form-label {
  top: 18px;
  transform: none;
}
.form-textarea:focus ~ .form-label,
.form-textarea:not(:placeholder-shown) ~ .form-label {
  top: 8px;
  transform: scale(0.75);
  transform-origin: left top;
  color: var(--primary);
  font-weight: 600;
}
.form-label-select {
  top: 10px;
  font-size: 11px;
  transform: scale(0.9);
  color: var(--primary);
  font-weight: 600;
}
.form-error {
  font-size: 12px;
  color: #F44336;
  margin-top: 4px;
  display: block;
  padding-left: 14px;
  min-height: 16px;
}
.form-input.error { border-color: #F44336; }

/* ===== BUTTONS ===== */
.btn-primary {
  flex: 1;
  padding: 14px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 14px rgba(255,111,97,0.35);
  transition: all var(--transition);
  text-align: center;
}
.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(255,111,97,0.25);
}
.btn-secondary {
  flex: 1;
  padding: 14px;
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
}
.btn-secondary:active { background: rgba(0,0,0,0.08); }
.btn-danger {
  flex: 1;
  padding: 14px;
  background: #F44336;
  color: white;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  transition: all var(--transition);
  text-align: center;
  box-shadow: 0 4px 12px rgba(244,67,54,0.3);
}
.btn-danger:active { transform: scale(0.97); }

/* ===== DIALOGS ===== */
.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 20px;
  z-index: 400;
  width: min(320px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  text-align: center;
}
.dialog.open {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}
.dialog-icon { font-size: 40px; margin-bottom: 12px; }
.dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.dialog-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}
.dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ===== CHAT ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}
.chat-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.2px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: none;
}
.chat-messages::-webkit-scrollbar { display: none; }

.chat-welcome {
  text-align: center;
  padding: 32px 16px;
}
.chat-welcome-icon {
  font-size: 52px;
  margin-bottom: 12px;
}
.chat-welcome h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.chat-welcome p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.chat-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.5;
  animation: bubbleIn 0.2s ease;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-bubble.user {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.chat-bubble.assistant {
  background: var(--surface);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: var(--shadow-sm);
}
.chat-bubble.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px;
}
.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-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--divider);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.chat-input {
  flex: 1;
  background: var(--surface-2);
  border-radius: var(--radius-xl);
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border: 1.5px solid transparent;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--primary); background: var(--surface); }
.chat-input::placeholder { color: var(--text-hint); }
.chat-send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255,111,97,0.35);
  transition: all var(--transition);
}
.chat-send-btn:active { transform: scale(0.9); }
.chat-send-btn:disabled {
  background: var(--surface-2);
  color: var(--text-hint);
  box-shadow: none;
}

/* ===== SNACKBAR ===== */
@keyframes snackIn {
  from { transform: translateY(100%) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.snackbar {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px);
  left: 16px; right: 16px;
  background: #1A1A1A;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  z-index: 500;
  display: none;
  box-shadow: var(--shadow-lg);
  animation: snackIn 0.25s cubic-bezier(0.4,0,0.2,1);
}
.snackbar.show { display: block; }

/* ===== RIPPLE ===== */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple-wave {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: rippleAnim 0.5s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ===== DETAIL SHEET ===== */
.detail-hero {
  height: 160px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-hero-emoji {
  font-size: 56px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.detail-row:last-child { border-bottom: none; }
.detail-key {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 90px;
  flex-shrink: 0;
}
.detail-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  flex: 1;
  line-height: 1.4;
}
.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-bottom: 8px;
}

/* ===== AI LOADING SPINNER ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.ai-spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,111,97,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* ===== AI RESULT CONTENT ===== */
.ai-result-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
}
.ai-result-section {
  margin-bottom: 16px;
}
.ai-result-section h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* ===== MISC ===== */
.no-results {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}
.category-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--accent-light);
  color: #7B5C00;
}
.idea-category-icon {
  font-size: 20px;
}
