.tool-hero {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  padding: 5rem 1.5rem 3rem;
  margin-top: 68px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tool-hero::before {
  content: ''; position: absolute;
  width: 400px; height: 400px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -150px; right: -100px;
}

.tool-hero::after {
  content: ''; position: absolute;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -100px; left: -50px;
}

.tool-hero-content { position: relative; z-index: 1; }

.tool-hero-icon {
  width: 72px; height: 72px; border-radius: 20px;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; margin: 0 auto 1.25rem;
  border: 1px solid rgba(255,255,255,0.2);
}

.tool-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800; color: white; letter-spacing: -1px; margin-bottom: 0.75rem;
}

.tool-hero p {
  font-size: 1rem; color: rgba(255,255,255,0.75);
  max-width: 480px; margin: 0 auto;
}

.tool-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* Stats Row */
.habit-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.habit-stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.habit-stat-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
}

.habit-stat-card:nth-child(1)::before { background: var(--gradient-primary); }
.habit-stat-card:nth-child(2)::before { background: linear-gradient(90deg, #10b981, #059669); }
.habit-stat-card:nth-child(3)::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.habit-stat-card:nth-child(4)::before { background: linear-gradient(90deg, #ef4444, #dc2626); }

.habit-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.habit-stat-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
}

.habit-stat-sub {
  font-size: 0.78rem;
  color: var(--text-light);
}

/* Main layout */
.habit-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* Add Habit */
.add-habit-panel {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  position: sticky;
  top: 88px;
}

.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.panel-header-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}

.panel-header-icon.amber { background: rgba(245,158,11,0.1); }

.panel-header-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.panel-body { padding: 1.5rem; }

.habit-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.habit-form-label {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.habit-form-input {
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  background: var(--bg);
  width: 100%;
}

.habit-form-input:focus {
  border-color: #f59e0b;
  background: white;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.08);
}

.habit-form-input::placeholder { color: var(--text-light); }

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}

.emoji-btn {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  border: 2px solid transparent;
}

.emoji-btn:hover { background: white; }
.emoji-btn.selected { background: white; border-color: #f59e0b; }

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
  position: relative;
}

.color-option.selected {
  border-color: var(--text);
  transform: scale(1.15);
}

.color-option::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0;
}

.color-option.selected::after { opacity: 1; }

/* Habits list */
.habits-panel {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.habits-panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.habit-items-list {
  display: flex;
  flex-direction: column;
}

.habit-item {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
  position: relative;
}

.habit-item:last-child { border-bottom: none; }
.habit-item:hover { background: var(--bg); }

.habit-item-emoji {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  border: 2px solid transparent;
}

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

.habit-item-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.habit-item-streak {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.habit-item-progress {
  flex: 1;
  max-width: 200px;
}

.mini-progress {
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 4px;
}

.mini-progress-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.6s ease;
}

.mini-progress-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.habit-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.habit-check-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  color: var(--text-light);
}

.habit-check-btn:hover { border-color: #10b981; color: #10b981; background: rgba(16,185,129,0.04); }

.habit-check-btn.done {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.habit-edit-btn, .habit-delete-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.825rem;
  transition: var(--transition);
}

.habit-edit-btn { background: rgba(67,56,202,0.06); color: var(--primary); }
.habit-edit-btn:hover { background: rgba(67,56,202,0.12); }

.habit-delete-btn { background: rgba(239,68,68,0.06); color: var(--danger); }
.habit-delete-btn:hover { background: rgba(239,68,68,0.12); }

/* Calendar */
.calendar-panel {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-top: 1.5rem;
}

.calendar-header {
  padding: 1rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calendar-nav-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.calendar-nav-btn:hover { border-color: var(--primary); color: var(--primary); }

.calendar-month {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.calendar-body { padding: 1.25rem 1.5rem; }

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 0.5rem;
}

.calendar-day-name {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  transition: var(--transition);
}

.calendar-day.other-month { color: var(--text-light); opacity: 0.4; }

.calendar-day.today {
  background: rgba(67,56,202,0.08);
  color: var(--primary);
  font-weight: 700;
  border: 1.5px solid rgba(67,56,202,0.2);
}

.calendar-day.completed {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  font-weight: 700;
}

.calendar-day.partial {
  background: rgba(245,158,11,0.12);
  color: #d97706;
  font-weight: 600;
}

/* Empty state */
.empty-habits {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-habits-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-habits-text {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.empty-habits-sub {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Edit modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text); }

@media (max-width: 900px) {
  .habit-layout { grid-template-columns: 1fr; }
  .add-habit-panel { position: static; }
  .habit-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .habit-stats { grid-template-columns: 1fr 1fr; }
  .habit-item-progress { display: none; }
}
