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

:root {
  --bg-primary: #0f0f12;
  --bg-secondary: #1a1a20;
  --bg-tertiary: #252530;
  --text-primary: #f5f5f7;
  --text-secondary: #9898a3;
  --text-muted: #5c5c6a;
  --accent: #e06c78;
  --accent-light: #f08c96;
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.15);
  --border: #2a2a35;
  --border-light: #3a3a45;
}

body {
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Tabs */
.app-header {
  margin-bottom: 20px;
}

.tabs-container {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 6px;
  gap: 4px;
}

.tab-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-button:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.tab-button.active {
  background: linear-gradient(135deg, var(--accent), #c54d5a);
  color: white;
  box-shadow: 0 4px 15px rgba(224, 108, 120, 0.3);
}

.tab-icon {
  font-size: 16px;
}

/* Date Navigation */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.nav-arrow {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.date-display {
  text-align: center;
}

.day-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.full-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.today-button {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.today-button:hover:not(:disabled) {
  background: var(--accent-light);
}

.today-button.muted {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: default;
}

/* Tab Content */
.tab-content {
  flex: 1;
  animation: fadeIn 0.3s ease;
}

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

/* Progress Section */
.progress-section {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.progress-bar {
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 5px;
  transition: width 0.5s ease;
}

.celebration {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--success);
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Sections */
.section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.section-header .section-title {
  margin-bottom: 0;
}

.add-button {
  padding: 6px 14px;
  background: var(--bg-tertiary);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-button:hover {
  background: var(--accent);
  color: white;
}

/* Priority & Todo Items */
.priorities-list,
.todos-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.priority-item,
.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.priority-item:hover,
.todo-item:hover {
  border-color: var(--border-light);
}

.priority-item.completed,
.todo-item.completed {
  opacity: 0.6;
}

.drag-handle {
  color: var(--text-muted);
  font-size: 14px;
  cursor: grab;
  user-select: none;
}

.priority-number {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  background: transparent;
  color: transparent;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checkbox:hover {
  border-color: var(--accent);
}

.checkbox.checked {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.priority-input,
.todo-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.priority-input::placeholder,
.todo-input::placeholder {
  color: var(--text-muted);
}

.priority-input.line-through,
.todo-input.line-through {
  text-decoration: line-through;
  color: var(--text-muted);
}

.delete-button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.delete-button:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Habits Grid */
.habits-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.habit-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.habit-button:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.habit-button.completed {
  background: var(--success-bg);
  border-color: var(--success);
}

.habit-emoji {
  font-size: 18px;
}

.habit-name {
  font-weight: 500;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Berrry Tip */
.berrry-tip {
  margin-top: auto;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(224, 108, 120, 0.1), rgba(224, 108, 120, 0.05));
  border: 1px solid rgba(224, 108, 120, 0.2);
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--accent-light);
}

/* Stats Tab */
.stats-tab .section-title {
  margin-bottom: 20px;
}

.stats-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.stats-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.week-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 120px;
  gap: 8px;
}

.day-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar-container {
  width: 100%;
  height: 100px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  border-radius: 6px;
  transition: height 0.5s ease;
}

.day-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Habits Tab */
.add-habit-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.emoji-picker-button {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.emoji-picker-button:hover {
  border-color: var(--accent);
}

.new-habit-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.new-habit-input:focus {
  border-color: var(--accent);
}

.add-habit-button {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-habit-button:hover:not(:disabled) {
  background: var(--accent-light);
}

.add-habit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 8px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
}

.emoji-option {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.emoji-option:hover {
  transform: scale(1.1);
}

.emoji-option.selected {
  border-color: var(--accent);
  background: rgba(224, 108, 120, 0.2);
}

.habits-manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.habit-manage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.habit-manage-item .habit-name {
  flex: 1;
}

.remove-habit-button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-habit-button:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

/* Footer */
.app-footer {
  margin-top: 32px;
  padding: 20px;
  text-align: center;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s ease;
}

.app-footer a:hover {
  color: var(--accent);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .app-container {
    padding: 12px;
  }

  .tabs-container {
    padding: 4px;
  }

  .tab-button {
    padding: 10px 12px;
    font-size: 13px;
  }

  .tab-label {
    display: none;
  }

  .tab-icon {
    font-size: 18px;
  }

  .date-nav {
    padding: 12px 0;
  }

  .nav-arrow {
    width: 36px;
    height: 36px;
  }

  .day-name {
    font-size: 18px;
  }

  .today-button {
    padding: 6px 12px;
    font-size: 12px;
  }

  .emoji-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-box {
    padding: 14px 10px;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 9px;
  }
}