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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0a0a0b;
  color: #f4f4f5;
  min-height: 100vh;
  padding: 20px;
}

.app {
  max-width: 900px;
  margin: 0 auto;
}

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

.brand h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.brand p {
  color: #a1a1aa;
  font-size: 14px;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: #6366F1;
  color: white;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #8B5CF6;
  transform: translateY(-2px);
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: #18181b;
  border-radius: 12px;
  margin-bottom: 24px;
}

.date-nav button {
  background: transparent;
  border: 1px solid #27272a;
  color: #f4f4f5;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.date-nav button:hover:not(:disabled) {
  border-color: #6366F1;
  color: #6366F1;
}

.date-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#dateDisplay {
  font-weight: 600;
  min-width: 200px;
  text-align: center;
}

#habitsList {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.habit-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.habit-card.completed {
  border-color: #22c55e;
  background: linear-gradient(to right, rgba(34, 197, 94, 0.1), transparent);
}

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

.habit-info {
  flex: 1;
}

.habit-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
}

.habit-streak {
  color: #a1a1aa;
  font-size: 13px;
}

.check-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid #27272a;
  background: transparent;
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.check-btn.checked {
  border-color: #22c55e;
  background: #22c55e;
  color: #0a0a0b;
}

.check-btn:hover:not(:disabled) {
  border-color: #6366F1;
}

.check-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stats-section {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.stats-section h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a1a1aa;
  margin-bottom: 16px;
}

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

.grid-col {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
}

.grid-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: #27272a;
}

.grid-cell.level-1 { background: #6366F133; }
.grid-cell.level-2 { background: #6366F166; }
.grid-cell.level-3 { background: #6366F1; }

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-card {
  background: #27272a;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 700;
  color: #6366F1;
  margin-bottom: 4px;
}

.stat-card .label {
  font-size: 13px;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
}

.modal-content h2 {
  margin-bottom: 16px;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 12px;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  color: #f4f4f5;
  font-size: 14px;
  margin-bottom: 12px;
}

.modal-content input:focus,
.modal-content select:focus {
  outline: none;
  border-color: #6366F1;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #6366F1;
  color: white;
}

.btn-primary:hover {
  background: #8B5CF6;
}

.btn-secondary {
  background: #27272a;
  color: #f4f4f5;
}

.btn-secondary:hover {
  background: #3f3f46;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #a1a1aa;
}

.empty-state p {
  margin-top: 8px;
  font-size: 14px;
}

@media (max-width: 600px) {
  .brand h1 {
    font-size: 24px;
  }
  
  .stats-cards {
    grid-template-columns: 1fr;
  }
}
